06 February, 2019

Shrinking Transaction Log

In order to truncate the transaction log, you must first back up the log. The database engine then automatically truncates the inactive records. However, truncating the log doesn’t reduce its size. Instead, you must shrink the log file, which removes one or more inactive virtual log files.


To shrink a log file, you can run a DBCC SHRINKFILE statement that specifies the name of the log file and the target size, in MB.
For example, the following DBCC SHRINKFILE statement shrinks the EmployeeDB_log file and target size in this statement is 10 MB.
-- shrink log file
DBCC SHRINKFILE (EmployeeDB_log, 10);

No comments:

Post a Comment