Create Job to clean transaction log automatically

Đỗ Nam 0 Reputation points
2023-12-14T09:33:04.3733333+00:00

We are using DB Cluster and FC to provide volume for it. We are deploying Monitoring Appliaction in our system

Every day, when we add a device and monitor it syncs a lot of logs on the MS SQL 2019 DB (Note that for MSSQL we also built HA, including 2 DB with AG and listener)

To deal with it in the short term  we have to truncate and delete logs manually

The process for it is that we have to remove the AG (Available Group) (all DB had added to AG) and change it to simple mode (from full mode). By doing that we can shrink the log to save 

more volume. After cleaning the log we add it to AG again.

Is there any way that we can create a job or scripts to schedule and automate that job instead of doing it manually? If you guys have it, please guide and help us

Thanks and Best Regards

Windows for business Windows Server User experience Other
SQL Server Other
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-12-15T22:10:06.4366667+00:00

    Hm, what's wrong with simply backing up the transaction log? And doing that often enough so that the transaction log does not grow out of bounds.

    What you describe is, permit me to say so, complete insanity. What's the point with having a database in an AG, if you take it out of the AG every day? Better in that case to take it out of the AG for good and set the database to simple recovery.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.