title: DBCC SHRINKFILE on log file not reducing size even after BACKUP LOG TO DISK
body: <p>I've got a database, [My DB], that has the following info:<br>
  SQL Server 2008<br>
  MDF size: 30 GB<br>
  LDF size: 67 GB  </p>
  
  <p>I wanted to shrink the log file as much as possible and so I started my quest to figure out how to do this.  Caveat: I am not a DBA (or even approaching a DBA) and have been progressing by feel through this quest.</p>
  
  <p>First, I just went into SSMS, DB properties, Files, and edited the Initial Size (MB) value to 10.  That reduced the log file to 62 GB (not exactly the 10 MB that I entered).  So, I attached SQL Profiler, saw that DBCC SHRINKFILE was being called.  I then entered that command into the query editor and here's the results.</p>
  
  <pre><code>DBCC SHRINKFILE (N'My DB_Log' , 10)
  </code></pre>
  
  <p>And the output was:</p>
  
  <pre><code>Cannot shrink log file 2 (My DB_Log) because the logical log file located at the end of the file is in use.
  DbId   FileId      CurrentSize MinimumSize UsedPages   EstimatedPages
  ------ ----------- ----------- ----------- ----------- --------------
  8      2           8044104     12800       8044104     12800
  
  (1 row(s) affected)
  
  DBCC execution completed. If DBCC printed error messages, contact your system administrator.
  </code></pre>
  
  <p>I then did some research on that and found this:</p>
  
  <p><a href="http://support.microsoft.com/kb/907511" rel="noreferrer">http://support.microsoft.com/kb/907511</a></p>
  
  <p>Which says that I need to backup the log file before the shrinkfile so that the virtual log files will be released and the shrinkfile can do its job - I don't know what that means... I'm just paraphrasing here :)</p>
  
  <p>So, I figured I'd try to backup the log file and then do a DBCC SHRINKFILE (and I changed the new log file size to 12800 since that was the MinimumSize identified in the output of the previous DBCC SHRINKFILE command)</p>
  
  <pre><code>BACKUP LOG [My DB] TO DISK = 'D:\SQLBackup\20110824-MyDB-Log.bak'
  GO
  DBCC SHRINKFILE (N'My DB_Log' , 12800)
  GO
  </code></pre>
  
  <p>The result was the same as the first go around.  I can only get the log file down to 62 GB.</p>
  
  <p>I'm not sure what I'm doing wrong and what I should try next.</p>