DBCC PAGE

  • Hi SSC,

    Im not an advanced DBA so apologies if this question seems simple but I would like some guidance. I am trying to understand the output of DBCC page using the following example - from sqlskills.com

    --------------------------------------------------------------------------

    Slot 0 Offset 0x60 Length 33

    Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

    Memory Dump @0x5C76C060

    00000000: 30000800 05000000 0300f802 00160021 †0..............!

    00000010: 0042616e 66667369 67687473 6565696e †.Banffsightseein

    00000020: 67†††††††††††††††††††††††††††††††††††g

    Slot 0 Column 0 Offset 0x11 Length 5

    destination = Banff

    Slot 0 Column 1 Offset 0x16 Length 11

    activity = sightseeing

    Slot 0 Column 2 Offset 0x4 Length 4

    duration = 5

    -----------------------------------------------------------------------

    Can someone just point out to me where:

    > Byte 0 is ? (This will help me to understand where bits 1-3 is to get the record type)

    > what is meant by TagA byte of the record metadata and TagB?

    again, apologies if this seems trivial, just require some assistance.

    thanks,

    A.

  • Dr.sql.com (10/10/2012)


    again, apologies if this seems trivial, just require some assistance.

    Arguing with DBCC Page is anything but trivial except for a limited number of people (<1000 at best, in my knowledge) on the planet. All of the planet. The rest of us just muddle through.

    Is this simply exploration or are you trying to resolve a particular issue?


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • TagA and TagB are just the two bytes (first and second) of the record header, nothing fancier than that. You don't need to decode them, DBCC Page does it for you, it contains info lik "Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS"

    The "00000000" is the offset, so byte 0 = offset 00000000, so the first byte of the dump, in this case, Byte 0 is 0x30. The record has a null bitmap and variable length columns (but I didn't need to decode the header for that, DBCC PAge did it for me "Record Attributes = NULL_BITMAP VARIABLE_COLUMNS"

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • This is more complicated than the Artificial Intelligence Module I did at University few years ago.....:ermm:

    @ Craig - No issue, Im just finding it frustrating that I cant grasp this.

    @ Gail - I was waiting for a MCM 😉

    Ok, so offset = 00000000 as you stated.

    Then Bits 1-3 of byte 0 is what? 3,0,0 or 0,0,0 ?

    It will probably help if I knew what you mean by 0x30? Is it related to 30000800?

    (might sound stupid to you - sorry)

  • Err...

    No offence, but if you don't understand hex representation, you're going to find the raw page dumps near impossible to decode.

    You might want to first read up on hexadecimal and binary and how they're represented. Wiki should have something decent.

    0x30 = 00110000 expressed in binary. It's the first byte of the header. So bits 4 and 5 are 1 and all the others are 0. Those two bits been set to 1 tell me (comparing against the structure of the DB header) that the row has a null bitmap (bit 4) and variable length columns (bit 5)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (10/10/2012)


    TagA and TagB are just the two bytes (first and second) of the record header, nothing fancier than that. You don't need to decode them, DBCC Page does it for you, it contains info lik "Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS"

    The "00000000" is the offset, so byte 0 = offset 00000000, so the first byte of the dump, in this case, Byte 0 is 0x30. The record has a null bitmap and variable length columns (but I didn't need to decode the header for that, DBCC PAge did it for me "Record Attributes = NULL_BITMAP VARIABLE_COLUMNS"

    Argghhh bytes, bits, Hex, offsets 🙂

    Gail has already given you a good starter, the 0x30 is the hex value. The offset is the point in the file at which the record starts and then has a corresponding record length The slots are the records which you can see hold the column data. It's probably worth reading through this[/url] to get more of an understanding. Playing with a Hex editor on a test database should enlighten you more. Just don't run it on your Production systems or you won't be popular 🙂

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • GilaMonster (10/10/2012)


    Err...

    No offence, but if you don't understand hex representation, you're going to find the raw page dumps near impossible to decode.

    You might want to first read up on hexadecimal and binary and how they're represented. Wiki should have something decent.

    0x30 = 00110000 expressed in binary. It's the first byte of the header. So bits 4 and 5 are 1 and all the others are 0. Those two bits been set to 1 tell me (comparing against the structure of the DB header) that the row has a null bitmap (bit 4) and variable length columns (bit 5)

    That makes sense, Im just rusty, I will dig up my notes on oct, hex and binary number representation.

    thanks.

  • sql.com (10/10/2012)


    @ Gail - I was waiting for a MCM 😉

    Why??

    i could be wrong but i'm sure I'm not. I wouldn't think that the MCM course will teach you hex, binary, file offsets and the like. You either know it or you don't.

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • GilaMonster (10/10/2012)


    Err...

    No offence, but if you don't understand hex representation, you're going to find the raw page dumps near impossible to decode.

    You might want to first read up on hexadecimal and binary and how they're represented. Wiki should have something decent.

    0x30 = 00110000 expressed in binary. It's the first byte of the header. So bits 4 and 5 are 1 and all the others are 0. Those two bits been set to 1 tell me (comparing against the structure of the DB header) that the row has a null bitmap (bit 4) and variable length columns (bit 5)

    Looks like an interesting read, I will read it tonight as evening study.

    thanks.

  • Perry Whittle (10/10/2012)


    sql.com (10/10/2012)


    @ Gail - I was waiting for a MCM 😉

    Why??

    i could be wrong but i'm sure I'm not. I wouldn't think that the MCM course will teach you hex, binary, file offsets and the like. You either know it or you don't.

    Just got over-excited. Nothing more, nothing less. I meant no disrespect.

  • Perry Whittle (10/10/2012)


    sql.com (10/10/2012)


    @ Gail - I was waiting for a MCM 😉

    Why??

    i could be wrong but i'm sure I'm not. I wouldn't think that the MCM course will teach you hex, binary, file offsets and the like. You either know it or you don't.

    MCM course?

    It's self-study these days. Videos sure, various training courses if you pay for them, but your choice.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Don't they run a boot camp in Redmond?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Nope. Not for almost 2 years now. That was the old form, 3 weeks training and exams in Redmond. Now it's just 2 exams, if you want training you have to organise and locate, or you can self-study.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (10/10/2012)


    Nope. Not for almost 2 years now. That was the old form, 3 weeks training and exams in Redmond.

    Ah right, gotcha.

    But, back to my original quote, no study material on hex, binary, file offsets or file layouts

    😉

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Perry Whittle (10/10/2012)


    GilaMonster (10/10/2012)


    Nope. Not for almost 2 years now. That was the old form, 3 weeks training and exams in Redmond.

    Ah right, gotcha.

    But, back to my original quote, no study material on hex, binary, file offsets or file layouts

    😉

    I think that's classified as 'stuff you should already know'. Paul's course, for eg, if you didn't understand hex then you'd really struggle with the page internals and log internals sections (better part of 2 full days). That said, you could probably pass the exams without knowing the binary structure of the mdf file.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic. Login to reply