in SQL Server, where the transaction log is often large, in addition to setting the database to auto shrink, you can use the following SQL command to quickly clear the transaction log in the database as follows:
-First step: Empty the log
DUMP TRANSACTION
DatabaseName
with
no_log
--Step two: Truncate the transaction log
BACKUP LOG
DatabaseName
with
no_log
--Step three: Shrinking the database
DBCC shrinkdatabase (databasename)
Some points need to be explained:
1. The above SQL commands need to be executed in sequence;
2. Executing the above commands is usually much faster than using the "shrink" command directly in the right-click menu
Resources:
SQL SERVER Database log is full, how to shrink the database log
Http://blog.csdn.net/faintbear/archive/2005/02/06/283316.aspx
How to shrink a database log
Http://www.cndiy8.com/data/web5701/20050228/20050228__3794589.html
(go) Resolution of an LDF file in SQL Server is too large