Question
How do you identify the type of backup taken and the logs needed to rollforward the database using the db2ckbkp utility in DB2?
Answer
When the history information is not available for a backup image, the db2ckbkp utility can be used to identity if the backup was taken online or offline, and which logs are needed to rollforward the database.
You can use the db2ckbkp utility with the -h option and look for the "Backup Mode" parameter in the media header information. If the "Backup Mode" parameter is set to "0", the backup was taken offline; if it is set to "1", the backup was taken online. Furthermore, in case of an online backup, you can see if the logs are included by looking at the "Includes Logs" parameter.
=====================
MEDIA HEADER REACHED:
=====================
Server Database Name -- SAMPLE
Server Database Alias -- SAMPLE
Client Database Alias -- SAMPLE
Timestamp -- 20100730130237
Database Partition Number -- 0
Instance -- db2inst1
Sequence Number -- 1
Release ID -- D00
Database Seed -- A05E5954
DB Comment's Codepage (Volume) -- 0
DB Comment (Volume) --
DB Comment's Codepage (System) -- 0
DB Comment (System) --
Authentication Value -- -1
Backup Mode -- 1
Includes Logs -- 1
Compression -- 1
Backup Type -- 0
Backup Gran. -- 0
Status Flags -- 20
System Cats inc -- 1
Catalog Partition Number -- 0
DB Codeset -- UTF-8
DB Territory --
LogID -- 1279748926
LogPath -- /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/
Backup Buffer Size -- 524288
Number of Sessions -- 1
Platform -- 12
If the backup was taken online, you can use the db2ckbkp utility with the -l and -o options to identify which logs are required to rollforward the database. Under the LOG.FILE.HEADER section, the "Head Extent ID" line will give you the first log the first log required, and the second number on the "Backup End Marker" will give you the last log required.
BufAddr PoolID Token Type Offset FileSize ObjectSize OrigSize Object Name
-------- ------ ----- ---- ---------- ---------- ---------- ---------- -----------
00000000: 0 0 8 0 12288 12288 0 "LOG.FILE.HEADER"
Consistency Counter one = 2245
Log Format Version = 10
Database Log ID = 1279748926
Number of Primary Log Files = 10
Number of Secondary Log Files = 2
Log File Size = 32
Transaction Table Size = 128
baseLso = 43857761
lowtranlsn = 0000000002A431DC
minbufflsn = 0000000002A18528
headlsn = 0000000002A18528
hdrSNextExtToRename = 0
Head Extent ID = 55
Last Commit Timestamp = 0 1970-01-01-00.00.00 GMT
Last Extent ID = 1280505751
Base TID = 00000000038B
Database seed = 2690537812
Log Chain Wrap Indicator = 0
rawLogDevSize = 0
rawLogHeadExtNum = 0
Past Log File Size = 32, starting from extent 0
Past Log File Size = 0, starting from extent 0
Past Log File Size = 0, starting from extent 0
Log File Path = Default
Dual Log Flags = 00000000
Mirror Log File Path =
Last CId = 1280505739
Soft checkpoint maximum = 131072
Log File Flag1 = 00004020
Log File Flag2 = 00000000
Log File Flag3 = 00000000
lfhLogAtBkp = (0, 0, 0)
FirstArchNum = 56
FirstArchNum2 = SQLPG_EXTNUM_UNDEFINE
RenameArchNum = 50
On-line Backup End Timestamp = 1280505777
Recoverable Start Time = 1280503612
Rollforward stoptime in effect = 0
Backup End Timestamp = 0
Backup End Marker = 1280505777, 78, 0000000002D0324C
Please refer to the db2ckbkp Information Center link in the 'Related URL' section below to obtain further details on how to use this utility.
Related information
db2ckbkp - Check backup command
http://www-01.ibm.com/support/docview.wss?uid=swg21442128