SQL server2008 cannot shrink the log, the error message is:
1: Unable to shrink log file due to minimum log space requirements
2: Unable to shrink log file 2 (Xxx_log) because the logical log file at the end of the file is in use
Describe:
Used to be a common online shrinkage code
Use [master]
GO
ALTER DATABASE Shujuku SET RECOVERY simple with no_wait
GO
ALTER DATABASE Shujuku SET RECOVERY Simple--Easy mode
GO
Use Shujuku
GO
DBCC shrinkfile (N ' Shujuku_log ', 11)
GO
Use [master]
GO
ALTER DATABASE Shujuku SET RECOVERY full with no_wait
GO
ALTER DATABASE Shujuku SET RECOVERY Full--Revert to complete mode
GO
The last contraction fails with the following failure information:
Unable to shrink log file 2 (Shujuku_log) because the logical log file at the end of the file is in use
Never shrink successfully! Find a variety of solutions, try a variety of SQL
But there's one thing I'm pretty sure about first. This log grew because I created a publication and a subscription, and I was able to shrink normally in the days that I just created, after a few days of running and then suddenly not shrinking.
Finally I found that the failure occurred on the subscribed client, because I only focused on the log of the publishing machine, ignoring the log of the subscribing client. The discovery of a subscription client's log has filled the client disk, causing the publication and subscription to not complete properly.
Therefore, the transaction of the publisher has not been properly executed, so the log file cannot be shrunk.
Solve:
1: Shrink the log on the subscribing client and create a scheduled task.
2: When the synchronization is complete, and then shrink the publisher, the log is properly contracted successfully.
SQL server2008 cannot shrink log