I just tried shrinking an overly big log file (FULL recovery model). This operation is not expected to always succeed and indeed the log was not shrunk.
But I observed that a lot of new log was generated. At a log file size of about 20GB each shrink attempt generated a few hundred MB of new log. I repeated the shrink operation a few times and received the same result each time.
Reading out the log I found that all of that space was for
LOP_SHRINK_NOOP log records. The web does not have information about this log record type.
DBCC LOGINFO shows that there is a mix of active and unused VLFs. There is one used VLF at the end of the file (
Status = 2).
Why does attempting to shink the log sometimes...
- ...cause lots of new log data?
- ...not shrink the log file although apparently work was performed on it?
- ...generate LOP_SHRINK_NOOP records? What does that log record type mean and when is it expected to appear?
The statement used was:
DBCC SHRINKFILE('logfilename', 8192) --shrink to 8GB
Log file size on disk: 20GB
Log allocated size as reported by DMV: ~2GB
The log was not backed up prior to performing the
SHRINKFILE. After performing a log backup the shrink succeeded.