* (1 / POWER (2.0, 16)) - right shift, reciprocal of left shiftĪn example of when you might use this information/code is during programmatic analysis of a corrupt database that DBCC CHECKDB cannot process to allow you to extract data as a last resort. The T-SQL for this involves floating point math as we need to use the reciprocal of POWER:ĬONVERT (FLOAT, (1 / POWER (2.0, 48)) - right shift, reciprocal of left shiftĬONVERT (FLOAT, - * CONVERT (BIGINT, POWER (2.0, 48)))) m_objId = ( AllocUnitId – ( m_indexId > 16.AllocUnitId = A | B (where | is a logical OR operation). ![]() Take the m_objId and left-shift by 16, giving value B.Take the m_indexId and left-shift by 48, giving value A.In other words, allocation unit is the smallest unit to save and manage files on disk in Windows. It is a unit of disk space allocation for files and directories as the filesystem allocates contiguous groups of sectors rather than individual disk sectors by default. M_xactReserved = 0 m_xdesId = (0:0) m_ghostRecCnt = 0 Another name for a file allocation unit is cluster. Pminlen = 8 m_slotCnt = 1 m_freeCnt = 8069 M_objId (AllocUnitId.idObj) = 97 m_indexId (AllocUnitId.idInd) = 256 M_typeFlagBits = 0x0 m_level = 0 m_flagBits = 0xa000 Page = (1:445) m_headerVersion = 1 m_type = 1 Basically everything prefixed with ‘Metadata:’ in the DBCC PAGE output below is NOT stored on the page itself: ![]() So if your unit size is 4KB, but the file is 2KB, you end up with 2KB of filler data. The unit size determines the smallest amount of space a file can take up on the drive. ![]() When DBCC PAGE dumps a page header’s contents, it does the necessary calculations and metadata look-ups to be able to tell you the allocation unit ID, partition ID, relational object ID, and relational index ID. The othe r reason the real size of a file and the amount of space it takes up on a disk are different has to do with the allocation units size. It’s been a long time since I’ve written a post about pure internals, but every so often I get asked how an allocation unit ID is calculated from the m_objId and m_indexId fields that are stored in the header of every page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |