SQL server2008 cannot shrink log

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.