SQL SERVER – FIX: The Log for Database Cannot be Shrunk Until All Secondaries Have Moved Past the Point Where the Log was Added

SQL SERVER - FIX: The Log for Database Cannot be Shrunk Until All Secondaries Have Moved Past the Point Where the Log was Added shrinkfun While preparing for a demo for a client I was hit with an interesting error in AlwaysOn Availability Group backup and restore scenario. In my lab setup, I had four nodes SQLAUTH1 to SQLAUTH4 and I have always on high availability turned on SQL Server 2016. I played and did several operations with database and found that I have bloated the transaction log file to 100 GB. And now I need to shrink the transaction log on SQLAUTH1. As soon as I did that, I was welcomed with below message about database cannot be shrunk until all secondaries have moved past the point.

The log for database ‘SQLAuth’ cannot be shrunk until all secondaries have moved past the point where the log was added.

It’s worth mentioning that I did add files in the database so above message is valid. I even took transaction log backup, but no luck. File usage was still shown as 99%.

WORKAROUND/SOLUTION

I looked around at AlwaysOn Dashboard and found that one of the secondary was not getting synchronized. Since it was a lab machine I decided to delete the AG and the thing came back to normal.

But in production, if you can’t afford to delete and reconfigure Always On availability group, then you need to find the cause why secondary is not getting synchronized with primary. In theory, the transaction log files on primary would keep on growing due to secondary not synchronizing with primary.  If you find that the data movement is suspended, then you may want to resume it and find the possible cause in the SQL Server ERRORLOG file

SQL SERVER – Where is ERRORLOG? Various Ways to Find ERRORLOG Location

One of the possible case I can think of is a change of the service account.

SQL SERVER – FIX: Msg 35250, Level 16, State 7 – The Connection to the Primary Replica is Not Active. The Command Cannot be Processed

STILL STUCK?

If you are not able to find the cause, feel free to contact me and use my consulting services. As you might know that I have been an independent consultant for a while and one of the services I provide is “On Demand (50 minutes)” service. This service is very helpful for organizations who are in need immediate help with their performance tuning issue. Though, I have set working ours for my regular clients, every single day, I keep two hours available for this offering. This way, I can make sure that anyone who urgently needs my help, can avail the same. Click here to read more about it.

Reference: Pinal Dave (https://blog.sqlauthority.com)

, , , , ,
Previous Post
SQL SERVER – Caution: Adding Node in AlwaysOn Availability Group
Next Post
SQL SERVER – SQL Agent Not Starting. The EventLog Service has Not Been Started

Related Posts

1 Comment. Leave new

  • Is there a T-SQL command to see if this status is still active ? I can add to my agent job as pre-requisite (to being primary replica) before I attempt to execute truncate and shrink

    Reply

Leave a Reply

Menu