Friday, December 21, 2007

How does one truncate a transaction log file in MS SQL

BACKUP LOG <DB NAME> WITH TRUNCATE_ONLY
USE <DB NAME>
DBCC SHRINKFILE (<Log Logical Name>, 20) -- where 20 = 20 MB

3 comments:

Unknown said...

EXEC sp_dboption , 'trunc. log on chkpt.', 'True'

Unknown said...

Use 'database Name'
GO

Alter Database 'database Name' Set Recovery Simple
GO

Alter Database 'database Name' Set Recovery Full
GO

DBCC SHRINKFILE ('log file name', 1)
GO

Unknown said...

Very helpful...