In a database the
primary file holds the critical information in a page called the boot
page. It is the 9th page of the primary file in the PRIMARY
file group. Let’s see what information this page holds.
-- create a database
boot
CREATE DATABASE Boot;
-- Using DBCC PAGE we will
examine the details in the boot page
DBCC TRACEON(3604)
DBCC PAGE (Boot, 1, 9, 3)
------- Page Header
-----------
Page
@0x0000000088D8A000
m_pageId =
(1:9) m_headerVersion = 1 m_type =
13
m_typeFlagBits =
0x0 m_level = 0 m_flagBits =
0x200
m_objId (AllocUnitId.idObj) =
99 m_indexId (AllocUnitId.idInd) = 0 Metadata: AllocUnitId =
6488064
Metadata: PartitionId =
0 Metadata: IndexId = 0 Metadata: ObjectId =
99
m_prevPage =
(0:0) m_nextPage = (0:0) pminlen =
0
m_slotCnt =
1 m_freeCnt = 6650 m_freeData =
1540
m_reservedCnt =
0 m_lsn = (34:26:3) m_xactReserved =
0
m_xdesId =
(0:0) m_ghostRecCnt = 0 m_tornBits =
-1508490807
------- Page Header
-----------
-- As can be seen some of the
important fields in the header say that : record in this page is 1, page type is
13 which means boot page, free space in the page is 6650 bytes, last lsn that
updated this page. We will now look at the data in this page
------------- Page Data
-------------------------
DBINFO
@0x000000000EFAA060
dbi_dbid =
7 dbi_status = 65536 dbi_nextid =
2105058535
dbi_dbname =
Boot dbi_maxDbTimestamp = 2000 dbi_version =
660
dbi_createVersion =
660 dbi_ESVersion = 0
dbi_nextseqnum = 1900-01-01
00:00:00.000 dbi_crdate = 2010-03-18
17:45:52.120
dbi_filegeneration =
0
dbi_checkptLSN
m_fSeqNo =
34 m_blockOffset = 27 m_slotId =
43
dbi_RebuildLogs =
0 dbi_dbccFlags = 2
dbi_dbccLastKnownGood =
1900-01-01 00:00:00.000
dbi_dbbackupLSN
m_fSeqNo =
0 m_blockOffset = 0 m_slotId =
0
------------- Page Data
-------------------------
-- Some of the important fields that we need to
look at are
-
dbi_dbid : unique identifier for the database (Can be obtained from sys.databases as well)
-
dbi_dbname : name of the database
-
dbi_version : physical version number of the database (660 here). dbi_createVersion is also the same.
-
dbi_crdate : creation date of the database
-
dbi_dbccLastKnownGood : the datetime of the last clean run of DBCC CHECKDB
-
dbi_LastLogBackupTime : last time the log backup was taken
-
dbi_differentialBaseGuid: the GUID generated by the last full database backup. All differential backup will check this guid to be restored on to.
-
dbi_checkptLSN : This is the last check point lsn. Every time a checkpoint happen the lsn is updated in the boot page. This is where the recovery starts when the database starts
-- I will chow you an example
of how the check point gets updated. Cusrrently the checkpoint LSN is
m_fSeqNo =
34 m_blockOffset = 27 m_slotId =
43
-- Lets see what is present
in the transaction log. I have just taken the extract of the transaction log
not the
entire log so that I can fit it in.
-- I now fire a CHECKPOINT
command. Basically I am forcing a checkpoint here
CHECKPOINT
-- Using DBCC LOG we can
check that the transaction log now has the following
2 rows for checkpoint
DBCC LOG (Boot, 4)
-- If you see the lsn in the
log for checkpoint is "00000022:00000037:003d". I am expecting the same lsn in
the boot page as well. Let's fire the DBCC PAGE on boot page and I get the
number as below. I need to convert it to hex as shown below
DBCC TRACEON(3604)
DBCC PAGE (Boot, 1, 9, 3)
-- 34 (dec) = 22
(hex)
-- 55 (dec) = 37
(hex)
-- 61 (dec) = 3d
(hex)
-- Clearly you can see that
the Checkpoint LSN in the log record "00000022:00000037:003d" is the LSN in the
boot page.
-- Two points to note here
-
Corruption of boot page is the corruption of database
- The information available in the boot page can also be obtained using DBCC DBINFO command