Replication | Not able to shrink Log file

Quick issue fix, In our replication setup we found the log file in not shrinking due to replication. If there is replication you can always wait for latency to be nil and the log file will be good to shrink but in our case database was not in replication.

But below query is confirming replication as the root cause.

SELECT log_reuse_wait_desc FROM sys.databases WHERE NAME = 'ReplicationName';

After validating we found database was restored from the database part of replication. A quick fix is run below commands to clean up replication entities from the database.

Exec sp_publication_validation 'ReplicationName'

Exec sp_droppublication 'ReplicationName' 
USE [master]
EXEC sp_replicationdboption 
@dbname = 'ReplicationName', 
@optname = N'publish', 
@value = N'false';

Once replication files are cleaned, we were able to release space from log file.

No comments:
Write comments

Please do not enter spam links

Meet US


More Services