title: tempdb not releasing free space after reboot
body: <p>I know there are many posts on the 'net about shrinking the tempdb, but usually it's about 'without restarting and restarting fixes it'.</p>
  
  <p>Usually our tempdb data file sits around 8M.  On friday I was doing a check of space on server and found it at 8G.  The tempdb log file is fine.</p>
  
  <p>Saturday night the server gets rebooted so I thought I would wait and simply check that that would release the 99% of free space it was showing.  </p>
  
  <p>It didn't.<br>
  I did the following today, when there was no one on network.</p>
  
  <ul>
  <li>I've tried restarting the service, which worked in the past</li>
  <li>I've tried shrinking database and files (all showing 99% free)</li>
  <li>I've done a transaction log full backup of the two 'main' databases in the instance</li>
  <li><p>tried DBCC FREEPROCCACHE, DBCC FREESYSTEMCACHE (‘ALL’), FREESYSTEMCACHE (‘ALL’), FREESESSIONCACHE, DROPCLEANBUFFERS, DBCC SHRINKFILE (N’tempdev’, NOTRUNCATE), DBCC SHRINKFILE (N’tempdev’ , 0, TRUNCATEONLY)  </p>
  
  <p>SELECT SUM(size)*1.0/128 AS [Tempdb size in MB] FROM tempdb.sys.database_files</p></li>
  </ul>
  
  <p>gives 8108.625</p>
  
  <pre><code> SELECT
   SUM (user_object_reserved_page_count)*8 as usr_obj_kb,
   SUM (internal_object_reserved_page_count)*8 as internal_obj_kb,
   SUM (version_store_reserved_page_count)*8  as version_store_kb,
   SUM (unallocated_extent_page_count)*8 as freespace_kb,
   SUM (mixed_extent_page_count)*8 as mixedextent_kb
  FROM sys.dm_db_file_space_usage
  </code></pre>
  
  <p>gives </p>
  
  <p>usr_obj_kb  internal_obj_kb version_store_kb    freespace_kb    mixedextent_kb
  1088    102848  512 7985216 14272</p>
  
  <pre><code>DBCC SHRINKDATABASE(N'tempdb' )
  </code></pre>
  
  <p>gives messages
  DBCC SHRINKDATABASE: File ID 1 of database ID 2 was skipped because the file does not have enough free space to reclaim.
  Cannot shrink log file 2 (templog) because the logical log file located at the end of the file is in </p>
  
  <p>Sorry if I'm missing something obvious, I'm another of those trying-to-self-teach computer people doing double-duty as dba admin in a medium-size company.</p>