Truncate SQL Server Transaction Log

Truncate SQL Server Transaction Log file

1. Change the recovery mode from full to simple

ALTER DATABASE dbname SET RECOVERY SIMPLE;

 
2. By using dbcc commands shrink the transaction log file

DBCC SHRINKFILE (@dbfilename , 1024)

 
3. Change back the recovery mode of database to full.

ALTER DATABASE dbname SET RECOVERY FULL;

 
4.  Took full backup of database
 
Note: If log shipping or database mirroring is establish please do not following the above method.

1. Take full backup of database and log file

2. Shrink the transactional log file of the database:

dbcc shrinkfile(dbfilename,1024);

 

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.