db2dart and inspect

5,822
-1

Published on

Published in: Technology, Business
1 Comment
9 Likes
Statistics
Notes
  • it is very useful
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
5,822
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
1
Likes
9
Embeds 0
No embeds

No notes for slide
  • The db2dart command can be used to verify the architectural correctness of databases and the objects within them. It can also be used to display the contents of database control files in order to extract data from tables that might otherwise be inaccessible.
    “Offline” tool for checking the architectural correctness of a database
    Checks validity of meta-data structures, page headers, row headers, etc.
    Critical for investigating problems involving data corruption
    It is “Offline Tool” why?
    The db2dart utility accesses the data and metadata in a database by reading them directly from disk. Because of that, you should never run the tool against a database that still has active connections. If there are connections, the tool will not know about pages in the buffer pool or control structures in memory, for example, and might report false errors as a result.
    Similarly, if you run db2dart against a database that requires crash recovery or that has not completed rollforward recovery, similar inconsistencies might result due to the inconsistent nature of the data on disk.
  • db2dart - Database analysis and reporting tool command
    Examines databases for architectural correctness and reports any encountered errors.
    Reports generated by the db2dart command are encoded in the same code page as the database that is being analyzed by the command. Similarly, parameter values specified as part of the db2dart command are interpreted with the same code page as the database that is being analyzed. The character string that is in the db2dart report file and input value is encoded in the database code page.
    The db2dart command does not perform code page conversions.
    When invoking the db2dart command, you can specify only one action. An action can support a varying number of options.
    Authorization
    You must have SYSADM authority to use the db2dart command.
    Required connection
    None. db2dart must be run with no users connected to the database.
    Command syntax
    >>-db2dart--database-name--+---------------------+-------------><     '-action--+---------+-'        '-options-'    
    Command parameters
    Inspection actions
    /DB Inspects the entire database. This is the default option. /T Inspects one or more tables. Requires two inputs: a table space ID, and either, the table object ID or a list of table object IDs, or the table name. /TSF Inspects only table space files and containers. /TSC Inspects the table space constructs of one or more table spaces, but does not inspect tables. Requires one input: the table space ID or a list of table space IDs. /TS Inspects one or more table spaces and their tables. Requires one input: the table space ID or a list of table space IDs. /ATSC Inspects constructs of all table spaces, but not their tables. Data formatting actions
    /DD Dumps formatted table data. If present, inline LOB data is also shown. Requires five input values: either a table object ID or table name, table space ID, page number to start with, number of pages, and verbose choice. /DI Dumps formatted index data. Requires five input values: either a table object ID or table name, table space ID, page number to start with, number of pages, and verbose choice.For nonpartitioned indexes on partitioned tables, the /DI action uses INDEX_OBJECTID and TBSPACEID from SYSCAT.INDEXES as the first two inputs to the /OI and /TSI options. The table name (/TN) option is not supported for the action.
    For partitioned indexes on partitioned tables, the /DI action uses PARTITIONOBJECTID and TBSPACEID from SYSCAT.DATAPARTITIONS. The table name (/TN) option is not supported for the action.
    /DM Dumps formatted block map data. Requires five input values: either a table object ID or table name, table space ID, page number to start with, number of pages, and verbose choice. The data shows whether a block has been reclaimed for use by the table space after a reorganization to reclaim multidimensional clustering (MDC) table blocks that were empty. /DP Dumps pages in hex format. For permanent object in DMS table space, action /DP requires three input values consisting of table space ID, page number to start with, and number of pages.
    For permanent object in SMS table space, action /DP requires five input values consisting of table space ID, object ID, page number to start with, number of pages, and object type.
    /DTSF Dumps formatted table space file information. /DEMP Dumps formatted extent map page (EMP) information for a DMS table. Requires two input values: table space ID and the table object ID or table name. /DDEL Dumps formatted table data in delimited ASCII format. Requires four input values: either a table object ID or table name, table space ID, page number to start with, and number of pages.The dumped delimited ASCII file is encoded in the database code page. The db2dart command does not perform code page conversions.
    The /DDEL parameter supports only the following column data types. If a table contains columns with any other data type, the column is skipped and not included in the delimited ASCII file.SMALLINT
    FLOAT
    REAL
    INTEGER
    TIME
    DECIMAL
    CHAR()
    VARCHAR()
    DATE
    TIMESTAMP
    BIGINT
    /DHWM Dumps high water mark information. Requires one input value: table space ID. /DXA Dumps formatted XML column data in ASCII format. Requires five input values: either a table object ID or table name, table space ID, page number to start with, number of pages, and verbose choice. /DXH Dumps formatted XML column data in HEX format. Requires five input values: either a table object ID or table name, table space ID, page number to start with, number of pages, and verbose choice. /LHWM Suggests ways of lowering the high water mark. Requires two input values: table space ID and number of pages (wanted high water mark). Repair actions
    /ETS Extends the table limit in a 4 KB table space (DMS only), if possible. Requires one input value: table space ID. /MI Marks index as invalid. When specifying this parameter the database must be offline. Requires two input values: table space ID and index object ID. For partitioned indexes, these values can be obtained from INDPARTITIONOBJECTID and INDPARTITIONTBSPACEID for SYSCAT.INDEXPARTITIONS. /RHWM Reduces high water mark through empty SMP extents. When specifying this parameter the database must be offline. Requires one input value: table space ID. Change state actions
    /CHST Change the state of a database. When specifying this parameter the database must be offline. Requires one input value: database backup pending state. Help
    /H Displays help information. Input value options
    /OI object-id Specifies the object ID. For the /T action, a comma-separated list of up to 64 objects IDs can be specified. If the corresponding /TSI option contains more that one input ID, only the first ID is used. Duplicate IDs are skipped. Logical IDs can be specified for the /T action. /TN table-name Specifies the table name. /TSI tablespace-id Specifies the table space ID. For the /TS or /TSC actions, a comma-separated list of up to 64 physical table space IDs can be specified. Duplicate IDs are skipped. /ROW sum Identifies whether long field descriptors, LOB descriptors, and control information should be checked. You can specify just one option or add the values to specify more than one option. 1 Checks control information in rows. 2 Checks long field and LOB descriptors. /RPT path Optional path for the report output file. /RPTN file-name Optional name for the report output file. /PS number Specifies the page number to start with. When used with the /DP action, the p suffix can be used for pool relative addressing. Specifying /PS 0 /NP 0 causes all pages in the specified object to be dumped. /NP number Specifies the number of pages. Specifying /PS 0 /NP 0 causes all pages in the specified object to be dumped. /V option Specifies whether the verbose option should be implemented. Valid values are: Y Specifies that the verbose option should be implemented. N Specifies that the verbose option should not be implemented. /SCR option Specifies type of screen output, if any. Valid values are: Y Normal screen output is produced. M Minimized screen output is produced. N No screen output is produced. /RPTF option Specifies type of report file output, if any. Valid values are: Y Normal report file output is produced. E Only error information is produced to the report file. N No report file output is produced. /ERR option Specifies type of log to produce in DART.INF, if any. Valid values are: Y Produces normal log in DART.INF file. N Minimizes output to log DART.INF file. E Minimizes DART.INF file and screen output. Only error information is sent to the report file. /WHAT DBBP option Specifies the database backup pending state. Valid values are: OFF Off state. ON On state. /QCK sum Specifies which quick option to perform. You can specify one option or add the values together to perform multiple quick options. 1 The /QCK 1 option applies to only the /DB, /T, and /TS actions. This option inspects page 0 of the DAT objects and partially inspects the index objects (does not inspect BMP, LOB, LF objects and does not traverse the entirety of the DAT or INX objects). This is the default option. 2 The /QCK 2 option applies to only the /DB, /T, /TS, /DD, /DI, /DM, /DEMP, /DDEL, /DXA, and /DXH actions. This option skips the system catalog table lookup on nonpartitioned database environments and on the catalog partition of partitioned database environments. This option has no effect on non-catalog partitions of partitioned database environments. The /QCK 2 option does not apply to the actions mentioned earlier if the /TN option is specified with a table name or if the /OI and /TSI options are specified with logical IDs. 4 The /QCK 4 option applies to only the /T, /TS, and /TSC actions. This option skips special system catalog table inspection or system catalog table space inspection. For the /TS, and /TSC actions, the /QCK 4 option skips the special system catalog table inspection. For the /T action, the /QCK 4 option skips inspection of the system catalog table space constructs. 8 The /QCK 8 option applies to only the /T, and /TS actions. This option skips the inspection of containers. For the /T action, the /QCK 8 option skips the inspection of all container files. For the /TS action, the /QCK 8 option inspects only container files that are associated with the specified table space. /TYP option Specifies the type of object. Valid values are: DAT Object type is DAT. INX Object type is INDEX. BKM Object type is BMP.
    Examples
    Example 1
    To dump 1000 pages of formatted index data on a non-range partitioned table with object ID 4 in a table space with ID 2 and starting with page zero, use the following db2dart command: db2dart IXMLDB /DI /TSI 2 /OI 4 /V Y /PS 0 /NP 1000
    Example 2
    To dump formatted block map data on range partitioned tables, use the following db2dart command: db2dart IXMLDB /DM /TSI 2 /OI 8 /V Y /PS 0 /NP 1000
    Where 8 is the value of partitionobjectid and 2 is the value of tbspaceid from SYSCAT.DATAPARTITIONS.
    Example 3
    To inspect table spaces with IDs 3, 4, 5, 8, 9, and 11, and to skip the system catalog table lookup and the special system catalog table inspection, use the following db2dart command. Only the containers associated with the specified table spaces are inspected. db2dart <dbname> /TS /TSI 3,4,5,6,9,11 /QCK 14 Where the /QCK 14 option represents the addition of quick options 2, 4, and 8. The /QCK 14 option performs all the individual operations of quick options 2, 4, and 8.
    Usage notes
    If you do not specify all the required input values when you invoke the db2dart command, you are prompted for the values. For the /DDEL action, the options cannot be specified from the command line, and must be entered when prompted by db2dart.
    The /ROW, /RPT, /RPTN, /SCR, /RPTF, /ERR, and /WHAT DBBP options can all be invoked in addition to the action. They are not required by any of the actions.
    The /DB, /T and /TS options inspect the specified objects, including associated XML storage objects. The /DB option includes all XML storage objects in the database, the /T option includes XML storage objects associated with the specified table, and the /TS option inspects all XML storage objects whose parent objects exist in the specified table space. As well, the /DEMP option dumps formatted EMP information including that for associated XML storage objects.
    When db2dart is run against a single table space, all dependent objects for a parent table in that table space are checked, irrespective of the table space in which the dependent objects reside. However, extent map page (EMP) information is not captured for dependent objects that reside outside of the specified table space. EMP information is captured for dependent objects found in the specified table space even when the parent object resides in a table space other than the one specified.
    For partitioned tables, the /DD, /DM, /DEMP, /DDEL, /DP, /DXA, /DXH actions use the PARTITIONOBJECTID and TBSPACEID columns from the SYSCAT.DATAPARTIONS catalog view as the input to the table object ID (/OI) and table space ID (/TSI) for a specific partition. The table name option (/TN) is not supported for these actions. The /T action supports the table name or global table object ID when use with global table space ID to check the entire table, and also supports using the PARTITIONOBJECTID and TBSPACEID columns from the SYSCAT.DATAPARTIONS catalog view as the input to /OI and /TSI to check a specific partition.
    In general, run the db2dart command when the database is offline. However, you do not need an offline database if you are specifying either the /DHWM and /LHWM actions. The report could be generated without the database being offline, but the reliability of the results will vary depending on how much write/update activity has occurred recently (less activity implies more reliable results).
  • Inspect database for architectural integrity, checking the pages of the database for page consistency
  • db2dart and inspect

    1. 1. IBM Software Group ® DB2DART • Database Analysis and Reporting Tool • By • Umesh Dande • umedande@in.ibm.com
    2. 2. IBM Software Group | DB2 Information Management Software – 1. DB2DART – An Overview – Example of DB2DART where and how to use  Performance issue  Index corruption  High water mark  Export table data 2. Inspect - An Overview Example of inspect  Estimate Row compression  Difference – db2dart and Inspect DB2DART
    3. 3. IBM Software Group | DB2 Information Management Software DB2DART – An Overview As this tool have vast potential still it is rarely used by DBA DBAs can use the tool – increases productivity db2dart db2trc db2support db2diag db2exfmt db2top db2pd
    4. 4. IBM Software Group | DB2 Information Management Software  db2dart - architectural correctness of databases Automatic recovery of the database  “Offline” tool for checking the architectural correctness of a database  Critical for investigating problems involving data corruption  It is “Offline Tool” why? DB2DART – An Overview
    5. 5. IBM Software Group | DB2 Information Management Software Command Syntax >>-db2dart--database-name- >< '-action' '-options-' /DB – Inspect entire database /T - Inspects only Table /TSF – Inspects only table space files and container /DD - Dumps formatted table data /DDEL – Dumps formatted data into in delimited format DB2DART – An Overview
    6. 6. IBM Software Group | DB2 Information Management Software  Granularity  Database: db2dart <db> /DB  Tablespace: db2dart <db> /TS  Table: db2dart <db> /T /TSI /OI  db2dart /MI -- Index level DB2DART – An Overview
    7. 7. IBM Software Group | DB2 Information Management Software  Sample DB2Dart Report DART (V9.7) Report: 2011-12-20-07.16.48.786055 Database Name: SAMPLE Report name: SAMPLE.RPT Old report back-up: SAMPLE.BAK Database Subdirectory: /home/umesh/ihubv97/NODE0000/SQL00006 Operational Mode: Database Inspection Only (INSPECT) ______________________________________________________________________________ ------------------------------------------------------------------------------------------------------------------------------- Action option: DB Connecting to Buffer Pool Services... Database inspection phase start. Tablespace file inspection phase start. Loading tablespace files. Inspecting next tablespace and associated containers. Inspecting next tablespace and associated containers. Inspecting next tablespace and associated containers. Inspecting next tablespace and associated containers. Inspecting next tablespace and associated containers. Inspecting next tablespace and associated containers. Inspecting next tablespace and associated containers. Inspecting next tablespace and associated containers. Inspecting next tablespace and associated containers. 9 tablespaces were identified and their containers checked. Tablespace file inspection phase end. DB2DART – An Overview
    8. 8. IBM Software Group | DB2 Information Management Software  Performance Issue  Correct Index corruption DB2DART – Check index marked invalid
    9. 9. IBM Software Group | DB2 Information Management Software DB2DART – Performance Issue  Performance Issue  Same Query running slow  Explain Plan looks identical  Index corruption might be problem Following is sample db2dart sample Index inspection phase start. Index obj: 26 In pool: 0 Scanning pages for unique index itoken(0) root page:1p. Scanning pages for unique index itoken(1) root page:2p. Error: page in tree but not marked in use: Object Page (722) Error: in page 722, pool page 722, of obj 26, in tablespace 0. Error: Page data will be dumped to report. To correct this use following command Mark index bad db2dart db2_name /MI Pool id : 0 Indexid : 26  According to INDEXREC setting index will be recreated
    10. 10. IBM Software Group | DB2 Information Management Software Check index marked invalid  How to correct index corruption  Get the table space and index id from syscat tables. • Get the TBSPACEID and INDEX_OBJECTID with the following command. • db2 "select TBSPACEID, IID, INDEX_OBJECTID from syscat.indexes where tabname='TAB_1' " • TBSPACEID IID INDEX_OBJECTID – ----------- ------ -------------- – 3 1 278 – 3 2 279 db2dart <DBNAME> /di /tsi <TBSPACEID> /oi <INDEX_OBJECTED> /ps 0 /np 1 /v y db2dart sample /di /tsi 3 /oi 278 /ps 0 /np 1 /v y • The requested DB2DART processing has completed successfully! • Complete DB2DART report found in: • /home/umesh/sqllib/db2dump/DART0000/SAMPLE.RPT 1.3 Check the SAMPLE.RPT • Free Page Map: • Page Type = x01000210 • pg0FileLSN = 0000 0DAC 5374 • nextSMP= 0 flags=x1 Indexes are marked INVALID db2dart db2_name /MI Pool id : 0 Indexid : 26  According to INDEXREC setting index will be recreated
    11. 11. IBM Software Group | DB2 Information Management Software DB2DART – Reduce high water mark  Reduce high water mark with db2dart (DMS tablespace)  Following is example of same ● Suppose we have tablespace with three tables 0 tab7 499|500 tab8 999|1000 tab9 1499|1999 TBS size is 2000 HWM is 1499 0 tab7 499|500 tab8 999|1000 tab9 1499|1999 Now we dropped tab7 and tab 9 TBS size is 2000 Still HWM is 1499 0 tab7 499|500 tab8 999|1000 tab9 1499|1999 We run db2dart TBS Size is 2000 HWM will be 999
    12. 12. IBM Software Group | DB2 Information Management Software • db2dart sample /dhwm /tsi 8 • High water mark: 288 pages, 9 extents (extents #0 - 8) • [0000] 65534 0x0e [0001] 65534 0x0e [0002] 65535 0x00 [0003] 4 0x40* • [0004] 4 0x00* [0005] 5 0x40* [0006] 5 0x00* [0007] 6 0x40* • [0008] 6 0x00* • db2dart sample /lhwm /tsi 8 /np7 • Dump high water mark processing - phase start. • Number of free extents below high water mark: 0 • Number of used extents below high water mark: 9 • High water mark: 288 pages, 9 extents (extents #0 - 8) • Lower high water mark processing - phase start. • Current high water mark: 8 • Desired high water mark: 0 • Number of used extents in tablespace: 7 • Number of free extents below original HWM: 2 • Number of free extents below desired HWM: 0 • Number of free extents below current HWM: 2 • High water mark: 288 pages, 9 extents (extents #0 - 8) • db2 drop table tab7 • db2dart sample /dhwm /tsi 8 • [0000] 65534 0x0e [0001] 65534 0x0e [0002] 65535 0x00 [0003] == EMPTY == • [0004] == EMPTY == [0005] 5 0x40* [0006] 5 0x00* [0007] 6 0x40* • [0008] 6 0x00* • Dump high water mark processing - phase start. • Number of free extents below high water mark: 2 • Number of used extents below high water mark: 7 DB2DART – Reduce high water mark
    13. 13. IBM Software Group | DB2 Information Management Software • db2 drop table tab9 • db2dart sample /dhwm /tsi 8 • High water mark: 288 pages, 9 extents (extents #0 - 8) • [0000] 65534 0x0e [0001] 65534 0x0e [0002] 65535 0x00 [0003] == EMPTY == • [0004] == EMPTY == [0005] 5 0x40* [0006] 5 0x00* [0007] == EMPTY == • [0008] == EMPTY == • Dump high water mark processing - phase start. • Number of free extents below high water mark: 4 • Number of used extents below high water mark: 5 • db2dart sample /lhwm /tsi 8 /np 5 • High water mark: 288 pages, 9 extents (extents #0 - 8) • Lower high water mark processing - phase start. • Current high water mark: 8 • Desired high water mark: 0 • Number of used extents in tablespace: 5 • Number of free extents below original HWM: 4 • Number of free extents below desired HWM: 0 • Number of free extents below current HWM: 4 • Step #1: Object ID = 5 • => Offline REORG of this table (do not specify a temporary tablespace • and do not use the LONGLOBDATA option). DB2DART – Reduce high water mark Offline Reorg suggestion
    14. 14. IBM Software Group | DB2 Information Management Software • Table: IHUBV97.TAB8 • DAT object size: 2 • INX object size: 0 • XDA object size: 0 • LF object size: 0 • LOB object size: 0 • LOBA object size: 0 • BMP object size: 0 • Total size of object parts: 2 • Minimum number of extents that will move by this operation: 2 • Current high water mark: 4 • Desired high water mark: 0 • Number of used extents in tablespace: 5 • Number of free extents below original HWM: 4 • Number of free extents below desired HWM: 0 • Number of free extents below current HWM: 0 • High water mark: 288 pages, 9 extents (extents #0 - 8) • [0000] 65534 0x0e [0001] 65534 0x0e [0002] 65535 0x00 [0003] == EMPTY == [0004] == EMPTY == [0005] 5 0x40* [0006] 5 0x00* [0007] == EMPTY == • [0008] == EMPTY == • Dump high water mark processing - phase start. • Number of free extents below high water mark: 4 • Number of used extents below high water mark: 5 DB2DART – Reduce high water mark
    15. 15. IBM Software Group | DB2 Information Management Software • db2 "reorg table IHUBV97.TAB8" • DB20000I The REORG command completed successfully. • High water mark: 224 pages, 7 extents (extents #0 - 6) • [0000] 65534 0x0e [0001] 65534 0x0e [0002] 65535 0x00 [0003] 5 0x40* • [0004] 5 0x00* [0005] == EMPTY == [0006] == EMPTY == • Dump high water mark processing - phase start. • Number of free extents below high water mark: 2 • Number of used extents below high water mark: 5 DB2DART – Reduce high water mark
    16. 16. IBM Software Group | DB2 Information Management Software DB2DART – Table data export  Table data got corrupted.  Table is not accessible  Select table fails with error sql1477N  This is scenario which happens when load is failed with non recoverable option  Alter table statement fails for activate not logged initially
    17. 17. IBM Software Group | DB2 Information Management Software Following is way to recover these tables We can see following error message in db2diag ADM5571W DB2 is marking object "0" of table "TBSPACEID=8.TABLEID=4“ bash-3.00$ db2dart sample /DDEL Table object data formatting start. Please enter Table ID or name, tablespace ID, first page, num of pages: 4,8,0,999999 2 of 2 columns in the table will be dumped. Column numbers and datatypes of the columns dumped: 0 VARCHAR() -VARIABLE LENGTH CHARACTER STRING 1 VARCHAR() -VARIABLE LENGTH CHARACTER STRING Default filename for output data file is TS8T4.DEL, do you wish to change filename used? y/n Y • Please enter filename for output data file (maximum characters 8 for name and 3 for extension): • tab7.del DB2DART – Table data export
    18. 18. IBM Software Group | DB2 Information Management Software Filename used for output data file is tab7.del. If existing file, data will be appended to it. Formatted data being dumped ... Dumping Page 0 .... Dumping Page 1 .... Dumping Page 2 .... Dumping Page 3 .... Dumping Page 4 .... Dumping Page 5 .... Dumping Page 6 .... Dumping Page 7 .... Dumping Page 8 .... Table object data formatting end. The requested DB2DART processing has completed successfully! Complete DB2DART report found in: /home/ihubv97/sqllib/db2dump/DART0000/SAMPLE.RPT • bash-3.00$ ls -l /home/ihubv97/sqllib/db2dump/DART0000/ • total 600 • -rw-r----- 1 ihubv97 db2iadm 1584 Dec 15 13:04 BUDGET.BAK • -rw-r----- 1 ihubv97 db2iadm 1566 Dec 15 13:04 BUDGET.RPT • -rw-r--r-- 1 ihubv97 db2iadm 39525 Dec 16 16:42 DART.INF • -rw-r----- 1 ihubv97 db2iadm 38194 Dec 11 12:52 PMR.BAK • -rw-r----- 1 ihubv97 db2iadm 156688 Dec 11 12:52 PMR.RPT • -rw-r----- 1 ihubv97 db2iadm 2551 Dec 16 16:42 SAMPLE.BAK • -rw-r----- 1 ihubv97 db2iadm 2013 Dec 19 11:18 SAMPLE.RPT • -rw-r----- 1 ihubv97 db2iadm 45864 Dec 19 11:18 tab7.del DB2DART – Table data export
    19. 19. IBM Software Group | DB2 Information Management Software How to differentiate between data page and index page Following is db2diag error captured for data page corruption A3751 LEVEL: Severe PID : 1106162 TID : 13366 PROC : db2sysc 0 INSTANCE: tsm48 NODE : 000 DB : TSMDB1 APPHDL : 0-7 APPID: 127.0.0.1.33030.110623062649 AUTHID : TSM48 EDUID : 13366 EDUNAME: db2redow (TSMDB1) 0 FUNCTION: DB2 UDB, buffer pool services, sqlb_verify_page, probe:2 MESSAGE : ZRC=0x86020001=-2046689279=SQLB_BADP "page is bad" DIA8400C A bad page was encountered. DATA #1 : String, 64 bytes Error encountered trying to read a page - information follows : DATA #2 : String, 23 bytes Page verification error DATA #3 : Page ID, PD_TYPE_SQLB_PAGE_ID, 4 bytes 2229977 DATA #4 : Object descriptor, PD_TYPE_SQLB_OBJECT_DESC, 88 bytes Obj: {pool:6;obj:5;type:0} Parent={5;5} Need to engage db2support for this correction DB2DART – Table data export
    20. 20. IBM Software Group | DB2 Information Management Software How to differentiate between data page and index page Following is db2diag error captured for index page corruption A3751 LEVEL: Severe PID : 1106162 TID : 13366 PROC : db2sysc 0 INSTANCE: tsm48 NODE : 000 DB : TSMDB1 APPHDL : 0-7 APPID: 127.0.0.1.33030.110623062649 AUTHID : TSM48 EDUID : 13366 EDUNAME: db2redow (TSMDB1) 0 FUNCTION: DB2 UDB, buffer pool services, sqlb_verify_page, probe:2 MESSAGE : ZRC=0x86020001=-2046689279=SQLB_BADP "page is bad" DIA8400C A bad page was encountered. DATA #1 : String, 64 bytes Error encountered trying to read a page - information follows : DATA #2 : String, 23 bytes Page verification error DATA #3 : Page ID, PD_TYPE_SQLB_PAGE_ID, 4 bytes 2229977 DATA #4 : Object descriptor, PD_TYPE_SQLB_OBJECT_DESC, 88 bytes Obj: {pool:6;obj:5;type:1} Parent={5;5} DB2DART can be used DB2DART – Table data export
    21. 21. IBM Software Group | DB2 Information Management Software  inspect database for architectural integrity, checking the pages of the database for page consistency  “Online” tool  Estimate row compression INSPECT – An Overview
    22. 22. IBM Software Group | DB2 Information Management Software • Sample output of inspect • db2 connect to sample • db2 inspect check database result sample.txt • The output of inspect will be stored in db2dump folder • Format this file with db2inspf • db2inspf sample.out.000 sample.out • DATABASE: SAMPLE • VERSION : SQL09073 • 2011-12-20-11.36.49.182557 • Action: CHECK DATABASE • Tablespace ID: 8 • Result file name: sample.out • Database phase start. • Tablespace phase start. Tablespace ID: 8 • Tablespace name: TEST1 • Tablespace Type: DMS - Database Managed Space; Extent size: 32; Page size: 8192; Number of containers: 1 • Container name: /home/ihubv97/test1 • Table phase start (ID Signed: -2, Unsigned: 65534; Tablespace ID: 8) : • Data phase start. Object: 65534 Tablespace: 8 • Data phase end. • Table phase end. INSPECT – database inspection
    23. 23. IBM Software Group | DB2 Information Management Software db2 inspect check table name tab8 results keep tab8.txt db2inspf tab8.txt tab8.out The inspect result will be like this DATABASE: SAMPLE VERSION : SQL09073 2011-12-20-12.05.30.791725 Action: CHECK TABLE Schema name: IHUBV97 Table name: TAB8 Tablespace ID: 8 Object ID: 5 Result file name: tab8.txt Table phase start (ID Signed: 5, Unsigned: 5; Tablespace ID: 8) : IHUBV97.TAB8 Data phase start. Object: 5 Tablespace: 8 Traversing DAT extent map, anchor 96. Extent map traversal complete. DAT Object Summary: Total Pages 18 - Used Pages 18 - Free Space 5 % Data phase end. Table phase end. Processing has completed. 2011-12-20-12.05.30.794316 INSPECT – Index and table checking
    24. 24. IBM Software Group | DB2 Information Management Software  To estimate the space saving db2 inspect rowcompestimate table name tab7 schema ihubv97 results keep rowcomp db2inspf rowcomp rowcomp.txt The inspect result will be like this DATABASE: SAMPLE VERSION : SQL09073 2011-12-20-14.07.54.811637 Action: ROWCOMPESTIMATE TABLE Schema name: IHUBV97 Table name: TAB7 Tablespace ID: 8 Object ID: 4 Result file name: rowcomp Table phase start (ID Signed: 4, Unsigned: 4; Tablespace ID: 8) : IHUBV97.TAB7 Data phase start. Object: 4 Tablespace: 8 Row compression estimate results: Percentage of pages saved from compression: 64 Percentage of bytes saved from compression: 64 Compression dictionary size: 2304 bytes. Expansion dictionary size: 3080 bytes. Data phase end. Table phase end. Processing has completed. 2011-12-20-14.07.54.827509 INSPECT – Table compression
    25. 25. IBM Software Group | DB2 Information Management Software Difference -DB2DART and Inspect Tests performed db2dart INSPECT SMS table spaces Check table space files YES NO Validate contents of internal page header fields YES YES DMS table spaces Check for extent maps pointed at by more than one object YES NO Check every extent map page for consistency bit errors NO YES Check every space map page for consistency bit errors NO YES Validate contents of internal page header fields YES YES Verify that extent maps agree with table space maps YES NO Table Space
    26. 26. IBM Software Group | DB2 Information Management Software Difference -DB2DART and Inspect Tests performed db2dart INSPECT Check data objects for consistency bit errors YES YES Check the contents of special control rows YES NO Check the length and position of variable length columns YES NO Check the LONG VARCHAR, LONG VARGRAPHIC, and large object (LOB) descriptors in table rows YES NO Check the summary total pages, used pages and free space percentage NO YES Validate contents of internal page header fields YES YES Verify each row record type and its length YES YES Verify that rows are not overlapping YES YES Data Object
    27. 27. IBM Software Group | DB2 Information Management Software Difference -DB2DART and Inspect Tests performed db2dart INSPECT Check for consistency bit errors YES YES Check the location and length of the index key and whether there is overlapping YES YES Check the ordering of keys in the index YES NO Determine the summary total pages and used pages NO YES Validate contents of internal page header fields YES YES Verify the uniqueness of unique keys YES NO Check for the existence of the data row for a given index entry NO YES Verify each key to a data value NO YES Index Object
    28. 28. IBM Software Group | DB2 Information Management Software Difference -DB2DART and Inspect Block Map Object Tests performed db2dart INSPECT Check for consistency bit errors YES YES Determine the summary total pages and used pages NO YES Validate contents of internal page header fields YES YES Tests performed db2dart INSPECT Check the allocation structures YES YES Determine the summary total pages and used pages (for LOB objects only) NO YES Long and LOB Object
    29. 29. IBM Software Group | DB2 Information Management Software  DB2DART should be schedule in regular maintenance plan  If not possible on production database (live database) , should be run on database, restored from backup Suggestions from DB2 Support Team
    30. 30. IBM Software Group | DB2 Information Management Software Questions

    ×