SQLUSA
Free Trial Save on Combos

SQL Server 2008 Best Practices
SQL Server 2005 Best Practices
SQL Server 2000 Best Practices

How to empty the transaction log file?

If for some reason the transaction log became too large, like 20GB for a 3GB database, or contains leftover from various processes such as replication, you can empty it quickly the following way. This method works even if dbcc shrinkdatabase or dbcc shrinkfile fails :

1. Exit users

2. Check for open transactions with dbcc opentran - resolve if any

3. Backup the database (full backup) with verification

4. Detach the database in Object Explorer

5. Rename the transaction log file (discard later e.g. in a week)

6. Attach the database in OE (remove "not found" .ldf file)

7. Perform dbcc checkdb

8. Backup database with verification

9. Open database for users

An empty log file will be created upon attach. Database should be fully operational.

 

The World Leader in SQL Server Training
 
SQLUSA.com Home Page