title: DBCC SHRINKFILE failing
body: <p>I'm trying to shrink a database on a test system but the file won't get any smaller. The size of the mdf file is 47 GB and unused space is 38 GB. A lot of data was removed from the database hence the large amount of unused space. </p>
  
  <p>The following error appears:
  Start dbcc shrinkfile ( Olympus_dat, 46912 ) at 2015-07-23 15:27:19.300
  DBCC SHRINKFILE: Page 1:6017543 could not be moved because it has not been formatted.</p>
  
  <p>How can I fix this error?</p>
  
  <p>SQL Server 2012 x64</p>
  
  <p>Additional information.
  The following queries return an error:</p>
  
  <pre><code>DBCC TRACEON(3604)
  GO
  
  DBCC page('Olympus', 1, 6017543, 1)
  Go
  
  DBCC TRACEOFF(3604)
  GO
  </code></pre>
  
  <p>DBCC execution completed. If DBCC printed error messages, contact your system administrator.</p>
  
  <p>PAGE: (14440:908631589)</p>
  
  <p>BUFFER:</p>
  
  <p>BUF @0x0000000009682040</p>
  
  <p>bpage = 0x00000002B46B8000          bhash = 0x0000000000000000          bpageno = (1:6017543)
  bdbid = 6                           breferences = 1                     bcputicks = 0
  bsampleCount = 0                    bUse1 = 23548                       bstat = 0x809
  blog = 0x5adb215a                   bnext = 0x0000000000000000          </p>
  
  <p>PAGE HEADER:</p>
  
  <p>Page @0x00000002B46B8000</p>
  
  <p>m_pageId = (14440:908631589)        m_headerVersion = 252               m_type = 226
  m_typeFlagBits = 0xf9               m_level = 216                       m_flagBits = 0xd676
  m_objId (AllocUnitId.idObj) = -1238914908                                m_indexId (AllocUnitId.idInd) = 23941
  Metadata: AllocUnitId = 6738992698879115264                              Metadata: PartitionId = 0
  Metadata: IndexId = -1              Metadata: ObjectId = 0              m_prevPage = (35510:854211095)
  m_nextPage = (61606:1041616947)     pminlen = 43990                     m_slotCnt = 27900
  m_freeCnt = 40464                   m_freeData = 34288                  m_reservedCnt = 12643
  m_lsn = (-257029635:1920476993:30788)                                    m_xactReserved = 11969
  m_xdesId = (25449:1820050307)       m_ghostRecCnt = 61532               m_tornBits = -213551362
  DB Frag ID = 1                      </p>
  
  <p>Allocation Status</p>
  
  <p>GAM (1:5623552) = ALLOCATED         SGAM (1:5623553) = ALLOCATED<br>
  PFS (1:6017472) = 0x40 ALLOCATED   0_PCT_FULL                            DIFF (1:5623558) = NOT CHANGED
  ML (1:5623559) = NOT MIN_LOGGED     </p>
  
  <p>CompressionInfo @0x00000000309682B0</p>
  
  <p>CompressionInfo Raw Bytes</p>
  
  <p>CompressionInfo size (in bytes) = 0 PageModCount = 50289                CI Header Flags = </p>
  
  <p>DATA:</p>
  
  <p>Slot 0, Offset 0x4ad2, Length 1, DumpStyle BYTE</p>
  
  <p>Record Type = (COMPRESSED) EMPTY_GHOST_RECORD                            Record size = 1</p>
  
  <p>CD Array</p>
  
  <p>Record Memory Dump</p>
  
  <p>000000003096EAD2:   05                                            .<br>
  Msg 0, Level 11, State 0, Line 0
  A severe error occurred on the current command. The results, if any, should be discarded.</p>