Clean up SQL Server logs

Source: Internet
Author: User
Tags microsoft sql server

Recently do a data acquisition project using the SQLSSERVER2014 database

Did not expect data to collect two or three days, C disk space has left 8M

Hurriedly looked at the SQLSEREVR database folder

Located in C:\Program Files\Microsoft SQL Server\mssql12. Mssqlserver\mssql\data

found that the database file is not big, only dozens of m, but the log file has reached 70G, no wonder 100G of hard disk space is full.

The following solutions are available on-line search

 Use [Master]GOALTER DATABASE [rm_db] SETRECOVERY Simple withno_waitGOALTER DATABASE [rm_db] SETRECOVERY Simple--Simple ModeGO Use [rm_db]GODBCCShrinkfile (N'Rm_db_log', One, Truncateonly)--Shrinking database
GO

Where rm_db is the database name, you can modify it according to your own situation

After cleanup, the log file becomes more than 10 m

This method is suitable for SQLServer2014, and some lower versions (such as 2005 and 2008) may not perform the same command

Clean up SQL Server logs

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.