SQL Server 2008 methods for deleting or compressing database logs

Source: Internet
Author: User

SQL Server 2008 methods to delete or Compress database logs 2010-09-20 20:15

Because the database log growth is set to "unlimited", so the time a long log file will inevitably be very large, a 400G database actually has 600G log file, seriously occupy the disk space. Because the main is to do OLAP, so the database itself will not have a big change, so the log will not have much effect, so try to shrink the database log file to very small or delete.

After searching for related solutions online, the answers are rich and colorful, but there are not many solutions that really work, so here's a way to share a csdn. This method is useful for describing the differences between SQL Server 2005 and SQL Server 2008 in shrinking database logs. At the same time, the method is highly efficient, and it only takes less than 30 seconds to shrink the 600G log to 10M.


Finally, attach the code:

Methods that apply to SQL Server 2005

  Log WITH" Span style= "line-height:normal; Color:teal; " >no_logdnname with no_ Loggouse DNName dbcc SHRINKFILE  (2go                 

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

Use[Master]Goalter DATABASEDnnameSET RECOVERY Simple withNo_waitGoalter DATABASEDnnameSET RECOVERY Simple--Simple ModeGouseDnnameGodbccShrinkfile(N ' Dnname_log ' truncateonly Goalter DATABASE dnname set RECOVERY full with no_waitGOALTER DATABASE  SET RECOVERY full go               

How SQL Server 2008 deletes or compresses database 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.