SQL Server 2005/2008 methods for compressing database logs

Source: Internet
Author: User

Methods that apply to SQL Server 2005

 1  backup  log  Dnname with   no_log  2  go  3  dump  transaction  Dnname with   no_log  4  go  5  use   Dnname  6  2  )  7  go  

Description: Because SQL Server 2008 has been optimized for file and log management, the above statements can be run in SQL2005 but have been canceled in SQL2008.

Methods that apply to SQL Server 2008

1  Use [Master]2 GO3 ALTER DATABASEDnnameSETRECOVERY Simple withno_wait4 GO5 ALTER DATABASEDnnameSETRECOVERY Simple--Simple Mode6 GO7  UseDnname8 GO9 DBCCShrinkfile (N'Dnname_log', One, Truncateonly)Ten GO One  Use [Master] A GO - ALTER DATABASEDnnameSETRECOVERY Full  withno_wait - GO the ALTER DATABASEDnnameSETRECOVERY Full  --revert to Full mode - GO

Description: [Advantage] This purge log runs short of elapsed time. [Cons] However, this action is best not to be used frequently, as it will result in system fragmentation. Log and diff backups can be truncated in normal state. The appropriate environment for this statement is used when the system's log file abnormally increases or the backup log time is too long to affect production.

Translated from: http://hi.baidu.com/wtnzone/item/53e71b40b46b1e96823ae17b

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.