0% found this document useful (0 votes)
10 views5 pages

Lesson 8b Recap Slides

Uploaded by

dc995dc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Lesson 8b Recap Slides

Uploaded by

dc995dc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ORCHESTRATOR

ADMINISTRATION AND MAINTENANCE


Summary
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance 3
Creating a Separate Database for Saving Items before Deletion 3
Deleting Old Data - Queue Items 4
Deleting Old Data - Logged Messages 4
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance
Please see this github project, which contains links to the documentation, to learn about and use
SQL Server Maintenance Solution - a set of scripts for running backups, integrity checks, and
index and statistics maintenance on all the Microsoft SQL Server editions, starting wi th 2005.

Creating a Separate Database for Saving Items before Deletion


Create new database: UiPathArchive

Creating backup tables:

Creating a backup table, ArchiveLogs, with the same structure as Logs


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

Creating a backup table, ArchiveQueueItems, with the same structure as QueueItems


select * into [UiPathArchive].[dbo].[ArchiveQueueItems] from [UiPah].[dbo].[QueueItems] where
1=2

Before deleting the data in Logs and QueueItems, copy it to the corresponding Archive tables.
Deleting Old Data - Queue Items
To delete old successfully processed queue items, for example those that are older than 45 days,
use the following query, which can be run manually or scheduled as a SQL Server Job. A different
number of days can be set by simply replacing the number 45 in the last line with the desired
number.
Optionally, include the TenantId.

DELETE FROM [UiPath].[dbo].[QueueItems]


/*
0 = new, 1 = in progress, 2 = failed,
3 = success, 4 = invalid, 5 = retried
*/
where status = 3
--and ReviewStatus != 0
--and TenantId = 1 -- default tenant
and ProcessingExceptionId is null
and DateDiff(day,CreationTime, GetDate()) > 45

Deleting Old Data - Logged Messages


To delete the messages of the “Info” level that are older than 45 days, run or schedule a SQL
Server Job with the following script. To delete the messages older than a different number of
days, simply replace the number 45 in the last line with the desired number.
Optionally, include the TenantId.
Additionally, comment out the “and level = 2” line to delete messages regardless of their log
level.

DELETE FROM [UiPath].[dbo].[Logs]


/*
0 = Verbose, 1 = Trace, 2 = Info,
3 = Warn, 4 = Error, 5 = Fatal
*/
where 1=1
and level = 2
-- and TenantId = 1 -- default tenant
and DateDiff(day, TimeStamp, GetDate()) > 45
Deleting Old Data - Elasticsearch
Orchestrator stores monthly indices for each tenant. If the old indices in Elasticsearch are kept
even if they are not used in searches or reports, the Elasticsearch performance and the memory
consumption are affected. For that reason, it is recommended to delete old indices.
Use the Elastic-Delete-Data.ps1 PowerShell script to delete indices. Please note that entire
indices are removed, not only partial index data. For example, if we go back 91 days from th e
current date, we reach 23rd April, so the entire index for the month of April is kept, and the first
deleted index is the one for March, followed by the one for February, and so on.

Usage
Elastic-Delete-Data.ps1 [-daysToKeep] <int> [-elasticURL] <string> [[-tenantName] <string>]
[[-elasticUser] <string>] [[-elasticPassword] <string>]
The daysToKeep and elasticURL parameters are mandatory.
If no specific tenant name is provided, “default” is assumed.
If X-Pack is installed and enabled, the script needs to authenticate to Elasticsearch. Provide the
username and the password using the corresponding arguments.

Examples:
.\Elastic-Delete-Data.ps1 -daysToKeep 91 -elasticURL http://elasticserver:9200
.\Elastic-Delete-Data.ps1 -daysToKeep 60 -elasticURL http://elasticserver:9200
-tenantName rpacoe
.\Elastic-Delete-Data.ps1 -daysToKeep 91 -elasticURL http://elasticserver:9200
-elasticUser superuser -elasticPassword secret01

Backup database
Implement regular backups of the SQL Server database.
Perform full backups weekly, and incremental backups daily.
The recommendation is to use the DatabaseBackup stored procedure that is created using the
award-winning script at this location.

You might also like