Optimum - How to Reduce database size

Created by Cheng Kah Poh, Modified on Wed, 11 Nov, 2020 at 10:29 AM by Cheng Kah Poh

1. Connect to the Database using 


Please refer How to install Microsoft SQL Management Studio

AND
Please refer How to Connect to Database use Microsoft SQL Server Management Studio


2. Start a New QueryCopy and Paste the following SQL Script into the New Query

3. Purge audit trail script:


DECLARE @PurgeDate DATE = '2014-12-31' DELETE FROM AuditDataItemPersistent WHERE ModifiedOn <= @PurgeDate DELETE FROM dbo.AuditedObjectWeakReference WHERE Oid NOT IN (SELECT AuditedObject from AuditDataItemPersistent) DELETE FROM dbo.XPWeakReference WHERE Oid NOT IN(SELECT AuditedObject from AuditDataItemPersistent UNION ALL SELECT NewObject from AuditDataItemPersistent UNION ALL SELECT OldObject from AuditDataItemPersistent )


4. Execute the Query


OR


Please refer How to Shrink Database Transaction Log , it another solution to reduce Database Size

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article