Truncate MS SQL 2008 Database Log File
use Test
GO
–see current file sizes
SELECT name,size from sys.database_files
–see current recovery model
select name,recovery_model_desc from sys.databases
–According to the articles if you switch the Recovery Model to Simple inactive part of the transaction log should be removed in MS SQL 2008.
–This command will reduce the log file somewhat
Alter database Test SET Recovery simple
–check if the recovery model is changed
select name,recovery_model_desc from sys.databases
–check file sizes
select name,size from sys.database_files
–changing the recovery model to Simple might not reduce the size enough. to reduce it further
DBCC SHRINKFILE (N’Test_log’ , 1)
–check file size
select name,size from sys.database_files
Source: http://www.bostonwebdeveloper.com/2009/09/truncate-ms-sql-2008-database-log-file/










Leave your response!