Create a nightly maintenance job

  • Updated

Optimizely Configured Commerce contains a nightly maintenance job that cleans up abandoned shopping cart records, maintains the application log, deletes orphaned custom properties, and removes obsolete scheduled task records. You should schedule the job to run each night during non-peak hours within your SQL server or by creating a Nightly Maintenance Scheduled Task within the Admin Console. Four finger tabs exist for creating an integration job: Details, Steps, Parameters, and History.

Details finger tab

  1. Click Add Job Definition.
  2. Populate the following fields as shown:
    • Job Name – Something like Nightly Maintenance Job
    • Job Type – Execution
    • Connection* – Internal. Go to Admin ConsoleAdministration > Connections to define this field.
    • Preprocessor – None
    • Integration Processor – None
    • Post Processor – ExecuteStoredProcedure
  3. Go to Notifications and Run Options. Populate the following fields for both:
    • Max Errors Before Failing – The number of errors allowed during processing before the job terminates.
    • Max Warnings Before Failing – The number of warnings allowed during processing before the job terminates.
    • Max Deactivation % – The number of products deactivated by the integration job before it triggers a failure. This protects from misconfigured or incorrect integration job definitions.
  4. Go to Recurrence and populate the following fields:
    • Run as a Recurring Job – Whether to run this job as a recurring job
    • Start Date/Time – Date and time for when the first job starts
    • End Date/Time – Date and time for when the last job ends
    • Repeat Every – The number of recurrences, such as None, Minutes, Hours, Days, or Months. This setting does not adjust for Daylight Savings Time.

Steps finger tab

Nothing is required in the Steps finger tab.

Parameters finger tab

  1. Go to Parameters.
  2. Click Add Job Definition Parameter.
  3. Enter the name NightlyMaintenance as the default value for Stored Procedure. This directly correlates to the name of the stored procedure that is deployed with the platform.
  4. Select the Value Type of String.
  5. Enter the Default Value.
  6. Enter the Prompt as the Stored Procedure Name.
  7. Click Save.
  8. Click Back or use the breadcrumb trail to click Nightly Maintenance Job. The Parameters finger tab displays the created parameter.

History finger tab

The History finger tab lists previously run jobs and their respective metadata.

Manually running the job

  1. Click More Options and select Schedule Job.
  2. Choose the Date/Time.
  3. Decide if it should run as a Real-Time Job or not.
  4. Click Schedule Job.
In recent releases of Configured Commerce, the nightly maintenance job includes a step that attempts to reactivate untrusted foreign keys within the database. Some older databases have these, which can lead to unexpected results from queries. If reactivating the foreign key is unsuccessful, a warning is logged indicating the problem, indicating that bad data is present in the database. When the bad data is cleaned, the next run of nightly maintenance should be clear.