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