SQL Server log file large shrinkage method (measured and useful)

Source: Internet
Author: User

Original: SQL Server log file large shrinkage method (measured and useful)

These two commands are executed consecutively, with less time and more apparent (multiple runs) until the effect is reached

-- truncate BACKUP LOG  to DISK = ' NUL ' -- Shrinkage DBCC Shrinkfile ('cloudmonitor_log')



You can use regular regular backup logs (such as once an hour) to prevent the log file from growing indefinitely.

The large shrinkage of SQL Server log files is not easy, as mentioned in the article:
Due to the first day log, tail log, and space reuse, when log truncation occurs after the backup logs, it is marked as reusable, but only the free space at the end of the file can be shrunk. This results in a 98% of the available space in the log file, but no movement is made to shrink. Skip "Active Log" as much as possible by backup + shrink continuous operation

"Shrink file" has tried, and will not achieve the effect:
1. Free unused space
2. Reorganize the page before releasing unused space

In response to this issue, there are other practices on the web that can be shrunk by modifying the "Simple recovery" mode, but this method does not apply to AlwaysOn of course, Microsoft Official also to this issue to explain: "In some cases, until the next log truncation, to shrink the log." "Official document: Factors that shrink the transaction log may delay log truncation
Related Article

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.