UiPath Orchestrator Guide

Maintenance Considerations

It is important to keep your Orchestrator database free from clutter. To do this, we recommend:

Creating a Maintenance Plan

You can create a maintenance plan using SQL Server Management Studio to help you periodically perform the following:

  • Check the database integrity
  • Shrink the database
  • Rebuild indexes
  • Update database statistics

To create a maintenance plan, follow the steps below:

  1. In SQL Server Management Studio, right-click SQL Server Agent and select Start. The SQL Server Agent is now started.
  1. Expand the Management directory, right-click Maintenance Plans and select Maintenance Plan Wizard. The Maintenance Plan Wizard window is displayed.
  2. Click Next. The Select Plan Properties step is displayed.
  1. Give a descriptive name to your plan, such as Orchestrator_v2017_1.
  2. Select the Single schedule for the entire plan or no schedule option, and then Next. The Select Maintenance Tasks step is displayed.
  1. Select the Check Database Integrity, Shrink Database, Rebuild Index, and Update Statistics options, and click Next. The Select Maintenance Task Order step is displayed.
  2. Do not change the default order, and click Next. The Define Database Check Integrity Task step is displayed.
  1. In the Databases list, select your Orchestrator SQL database and click OK.
  2. Click Next. The Define Rebuild Index Task step is displayed.
  1. Select your Orchestrator SQL database and click OK.
  2. Click Next. The Define Update Statistics Task step.
  3. In the Databases list, select your Orchestrator SQL database and click OK.
  4. Under the Scan Type section, select Sample by and set it to 30%.
  1. Click Next. The Select Report Options step is displayed.
  2. We recommend clearing the Write a report to a text file option.
  1. Click Next. The Complete the Wizard step is displayed.
  1. Review your settings and when ready, click Finish. The maintenance plan is created.

Creating an Archive Database

It is recommended that you create a separate database in which to save items before you delete them. As a result, this database acts as an archive for the items that you may need to store for certain reasons such as audits.

For example:

create database [UiPathArchive]
select * into [UiPathArchive].[dbo].[ArchiveLogs] from [UiPah].[dbo].[Logs] where 1=2

Deleting Old Data Periodically

Queue Items

We recommend removing transactions that have been processed and are older than 45 days. The following statuses can be used:

  • 0 - New
  • 1 - In Progress
  • 2 - Failed
  • 3 - Success
  • 4 - Invalid
  • 5 - Retried

The following example deletes successful transactions that are older than 45 days, from the default tenant.

  DELETE FROM [UiPath].[dbo].[QueueItems]
  where status = 3
  --and ReviewStatus != 0
  and TenantId = 1 -- default tenant
  and ProcessingExceptionId is null
  and  DateDiff(day, CreationTime, GetDate()) > 45

Logs

If you maintain more than two million logs in the SQL database, you might have some performance issues. For more than that, we recommend using Elasticsearch.

The following levels exist and can be used:

  • 0 - Verbose
  • 1 - Trace
  • 2 - Info
  • 3 - Warn
  • 4 - Error
  • 5 - Fatal

The following example removes Info messages older than 45 days, from the default tenant:

DELETE FROM [UiPath].[dbo].[Logs]
where level = 2
and TenantId = 1 -- default tenant
and  DateDiff(day, TimeStamp, GetDate()) > 45

Maintenance Considerations