September 22

Citrix: Reducing the RMSummaryDatabase Size

Once you’ve backed up the RM summary Database, you can run a manual purge on the prod database to get rid of what was backed up. Here’s the query (to be run from Query Analyzer):


DECLARE @farmName nvarchar(255)
DECLARE @sCutoffDate datetime
SELECT @farmName = N’EnterYourFarmName’
SELECT @sCutoffDate = ‘2007-03-05 16:20:00′ <= Enter the relevant date.
EXEC PurgeUnbilledSessProc @farmName, @sCutoffDate
EXEC Purgeevents @farmName, @sCutoffDate
EXEC Purgemetrics @farmName, @sCutoffDate
********************************************Note: If your customer is using billing, you will need to add this line as well:

EXEC PurgeBilledSessProc @farmName, @sCutoffDate

Note2: Is your customer using web interface? If so, you might want to get rid of randomly generated client name from the LU_CLIENT table that will not be used anymore:

Delete FROM LU_client WHERE PK_clientID NOT IN ( SELECT FK_clientID FROM SDB_session )
and PK_clientID NOT IN ( SELECT FK_clientID FROM SDB_process )
and PK_clientID NOT IN ( SELECT FK_clientID FROM SDB_clienthistory )

Note3: Same thing for the LU_USER table:

Delete FROM LU_USER WHERE PK_userID NOT IN ( SELECT FK_userid FROM SDB_process )
and PK_userID NOT IN ( SELECT FK_userid FROM SDB_session )
There are many ways to reduce the size of the RMDB but it all depends on what is expected from it so, unless the storage for backup is not an issue, you might need to understand what it is used for (billing, report types, etc).

By Vincent


Copyright 2021. All rights reserved.

Posted September 22, 2011 by Timothy Conrad in category "Software

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B