SQL Server log file cleanup

Source: Internet
Author: User

When you restore a database from a database backup, you find that the log file actually has more than 120 g, not through the SQL management, resolute use DBCC statement cleanup success! Free space! and clear and speed!

First of all, it's important to look at the type of backup data, or not to clean up

Select Name, Recovery_model_desc from sys.databases

After execution, you can see the category of Recovery_model_desc, and if it is full type, be sure to change it to simple type first.

ALTER DATABASE name set Recovery simple

Start releasing

DBCC shrinkfile (N ' database log file name ', 10)

Query after successful release

SELECT NAME, size from sys.database_files

Change back to full type

ALTER DATABASE Dnnzhongchangoa SET Recovery full

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.