MSSQL2019 with Always On Availability How to Truncate?

Kelvin Shee 1 Reputation point
2022-02-24T12:50:13.277+00:00

Hello everyone,

I am using MSSQL2019 with Always On Availability setup.
and I facing my DB_log is usage higher and want to truncate all DB Log.

how I able to using SQL Job Agent with scheduler taks to clean all the DB log?

Do have any script can share or how I able truncate it?
I try some script is not able run with Always On Availability!
appreciation for your help.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,788 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Seeya Xi-MSFT 16,471 Reputation points
    2022-02-25T06:25:08.51+00:00

    Hi @Kelvin Shee ,

    Welcome to Microsoft Q&A!
    Please refer to my answer i post in this thread: https://learn.microsoft.com/en-us/answers/questions/748048/alwayson-hadr-1.html
    For databases with a full or bulk log recovery model, the system truncates the transaction log only after a successful backup of the transaction log.
    So you'd better create an maintenance plan to do the backup.

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Kelvin Shee 1 Reputation point
    2022-02-25T20:41:24.887+00:00

    I try backup transaction log and then I doing shrink log

    some DB log is already deduct, but some DB the log file size is still same?

    may I know what happen for the DB log after I shrink but the file size is still same?


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.