There are
fixed boundaries from which a transaction log file can be shrunk. The size of
the virtual log files within the log determines the possible reductions in
size. Therefore, the log file can never be shrunk to a size less than the
virtual log file. Also, the log file is reduced in increments equal to the size
of the virtual log file size. For example, a transaction log file of 1 GB can
consist of five virtual log files of 200 MB each. Shrinking the transaction log
file deletes unused virtual log files, but leaves at least two virtual log
files. Because each virtual log file in this example is 200 MB, the transaction
log can be reduced only to a minimum of 400 MB and only in increments of 200
MB. To be able to reduce a transaction log file to a smaller size, create a
small transaction log and let it grow automatically, instead of creating a
large transaction log file all at once.
A DBCC
SHRINKDATABASE or DBCC SHRINKFILE operation immediately tries to reduce a
transaction log file to the requested size (subject to rounding). You should
backup the log file before shrinking the file to reduce the size of the logical
log and mark as inactive the virtual logs that do not hold any part of the
logical log.
Shrinking
can occur only while the database is online and, also, while at least one
virtual log file is free. In some cases, shrinking the log may not be possible
until after the next log truncation. Typically,
truncation occurs automatically under the simple recovery model when database
is backed up and under the full recovery model when the transaction log is
backed up. However, truncation can be delayed by a number of factors
No comments:
Post a Comment