How to clear and shrink Database Log Files

Source: Internet
Author: User
When operating on a database, the program prompts that the data log is too large; open the Directory Check of the data file storage, it is found that the LDF file has reached more than 2 GB. The cleanup method is shown on the Internet. I tried it to achieve the desired effect. After completion, the LDF file is less than MB. Back up data before performing the operation...

My operations are inQuery AnalyzerThe operation is completed as follows:

1. dump transaction DataBase_Name WITH NO_LOG

2. backup log DataBase_Name WITH NO_LOG

3. dbcc shrinkdatabase (DataBase_Name)

The three steps are as follows:

1:Clear logs
2:Truncation transaction logs
3
:Shrink Database

The operations in the first two steps are fast, and the third part takes a lot of time.

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.