Trucate Transaction Log in SQL Server 2000/2005

In SQL Server, it is important to keep the size of the transaction log at a decent size. If the transaction log fills up your disk drive. It can hang up the database. T-log is like archived redo log files in oracle database. Instead of storing multiple files, SQL server stores the t-log as a single file with extension .ldf . The t-log file consists of multiple virtual files with the log sequence no. ( out of scope for this article 🙂 )
Procedure to shrink transaction log :

C:\> osql -u sa

password: ****




USE dbname;
SELECT * FROM sysfiles;

Then, using the logfile name that sysfiles revealed in the last
step, shrink log size to the –desired size in mb, in this case 500.

USE dbname;
DBCC SHRINKFILE(logfilename,500)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s