Clear System log and database (SQL Server) log best practices

Source: Internet
Author: User
Tags system log

Problems encountered in a project: The system log is too large, and later deleted with the DELETE statement (rather slow), the results of the database log becomes very large (almost 10G), so you have to delete the database log.

Method:

--partial logs in the backup system
--select * into #keep from Ccssystemlog WHERE logtime > ' 2011-12-31 '
--truncate TABLE Ccssystemlog
--insert ccssystemlog SELECT * from #keep
--drop Table #keep


--Clear the database log (you can also use the database detach--delete log---> Append data method)
--dump TRANSACTION database name with no_log;
--DBCC shrinkfile (' Database name _log ', 1);


--This sentence is shrinking data files and log files
--DBCC shrinkdatabase (database name)

Clear System log and database (SQL Server) log best practices

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.