Manually trucate and shrink the transaction log for SQL 2005

In some situation, the transaction log grow too big until the harddisk space become unavailable and backup cannot be performed to truncate the log immediately.
 
How to truncate and shrink the transaction log manually?
Run the below 2 SQL query:
===============================
use databasename
DBCC LOGINFO('databasename')
go
==============================
Note down the fileID
==========================
Use databasename
DBCC shrinkdatabase (N'databasename', fileid, truncateonly)
Backup LOG databasename WITH TRUNCATE_ONLY
DBCC shrinkdatabase (N'databasename', fileid, truncateonly)
GO
========================================
 
Please perform full database backup immediately after the above SQL statement.
 

1 comment:

Casendra said...

work till short jor....

Related Posts with Thumbnails

Saving The Seahorse Means Saving The Sea