AG log backup and truncation

Chaitanya Kiran 801 Reputation points
2024-06-17T13:46:56.01+00:00

I have an AG with 4 secondary replicas. If i take log backup on the first secondary replica, does the tlog on primary replica gets truncated?

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

Accepted answer
  1. LucyChen-MSFT 5,060 Reputation points Microsoft Vendor
    2024-06-18T02:02:37.1166667+00:00

    Hi @Chaitanya Kiran ,

    Thank you for reaching out and welcome to Microsoft Q&A.

    If i take log backup on the first secondary replica, does the tlog on primary replica gets truncated?

    Yes! Truncation occurs automatically after performing a Transaction Log backup process, and the Transaction Log is not waiting for an active transaction or any high availability feature, such as Mirroring, Replication or Always On Availability Group, unless log truncation is delayed for some reason.

    You can get more detailed information from this official document, hope this can help you well.

    NOTE: The log backups on the primary will not truncate the log if ALL of the secondary replicas have not completed the processing of the log records for REDO. Please refer to this article.

    Please feel free to share your issue here if you have any confusions. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.

    Best regards,

    Lucy Chen


    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.

    https://docs.microsoft.com/en-us/answers/support/email-notifications

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. RahulRandive 10,226 Reputation points
    2024-06-17T13:50:54.12+00:00

    Hi @Chaitanya Kiran

    Yes, when you take a log backup on a secondary replica, the transaction log on the primary replica gets truncated. This is because the transaction log chain is maintained across all replicas in an availability group, and taking a log backup on any replica truncates the log on all replicas in the group.

    Thank You!

    1 person found this answer helpful.
    0 comments No comments

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.