Run BarTender System Database Maintenance using SQL Server Stored Procedures
Question
How can you run BarTender System Database maintenance remotely?
Applicable to
BarTender 2016 and later
Solution
Please perform a backup and consult your IT team or Database Administrator before making any changes to your BarTender System Database, as your database may be corrupted or lost if the changes are made incorrectly.
You can use SQL Server Stored Procedures to manually conduct maintenance on your BarTender System Database.
- Please download SQL Server Management Studio first. You can download the installer here.
- Connect to your SQL Server Instance that hosts the BarTender System Database.
- Right-click the Datastore (The default name of the BarTender System Database) table and select New Query:
- Enter the following query and then select Execute. This will delete all records older than 5 days. NOTE: To change the time frame, see the help file linked below for definitions of the variables in use here.
DECLARE @timeThreshold int
DECLARE @timeUnits int
DECLARE @recordType nvarchar(1024) DECLARE @useLock int
DECLARE @lockHost nvarchar(1024)
DECLARE @result int
DECLARE @numRows int
--Choose how many units in the past--
SET @timeThreshold = 5
--Where 0 = Days, 1 = Weeks, 2 = Months--
SET @timeUnits = 0
SET @recordType = N'ALLR' --All Record Types
SET @useLock = 0
EXEC dbo.SpDeleteOlderRecords @timeThreshold, @timeUnits, @recordType, @useLock, @lockHost, @result output
When database maintenance must be run manually, it is recommended to additionally Troubleshoot the Transaction Logs.