Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
VivekSahu
Advisor
Advisor

Introduction (hdbpersdiag)


Both understanding the root cause of the corruption and resolving it is very important. You may not be able to resolve a corruption if you don't understand how it is introduced, and you may have new corruptions if you haven't understood and resolved the root cause of previous corruptions.

Consistency check in logical layer of database is checked via :
CALL CHECK_TABLE_CONSISTENCY('CHECK',NULL,NULL)

But, there is also a mechanism to diagnose corruptions at physical level. hdbpersdiag tool is a persistence-based check method that will check structure-based aspects of the persistence only. It can be executed for all data volumes. Downtime is needed to run the consistency check of hana persistence and hana instance must also be stopped before executing the tool. Trace for hdbpersdiag tool is written by default into the database trace directory.

Syntax


The tool hdbpersdiag is an expert tool and only the "check all" option is meant for public use. Make sure that you only use it if you know what you do.It is delivered as part of the standard SAP HANA installation in directory /usr/sap/<sid>/HDB<inst_id>/exe.
hdbpersdiag -c 'check all' <DATA_VOLUME_PATH>

Attention: Needs additional memory of up to 2 % of the data volume size (worst case if many small 4 KB pages exist)

Example



  1. If persistence encryption is enabled for your SAP HANA database, use it like below :
    <sid>adm@<host>:/usr/sap/<SID>/HDB02> hdbpersdiag -c -e 'check all' /hana/data/<SID>/mnt00001/hdb00001
    Loaded library 'libhdbunifiedtable'
    Loaded library 'libhdblivecache'
    Trace is written to: /usr/sap/<SID>/HDB02/<host>/trace
    Mounted DataVolume(s)
    #0 /hana/data/<SID>/mnt00001/hdb00001/ (8.2 GB, 8809873408 bytes)
    Tips:
    Type 'help' for help on the available commands
    Use 'TAB' for command auto-completion
    Use '|' to redirect the output to a specific command. Available command(s) are:
    count Count the number of lines
    dump Save the output to a file
    grep Print lines that contain a match for a pattern
    head Print the first n lines
    more Print text, one screen at a time
    tail Print the last n lines
    INFO: KeyPage loaded and decrypted with success
    Default Anchor Page OK
    Restart Page OK
    Default Converter OK
    RowStore Converter OK
    Logical Pages (308900 pages) OK
    Logical Pages Linkage OK
    ContainerDirectory OK
    ContainerNameDirectory OK
    FileIDMappingContainer OK
    UndoFileDirectory OK
    LOBContainerDirectory OK
    MidSizeLOBContainerDirectory OK
    LOBFileIDMappingContainer OK​


  2. If persistence encryption is not enabled, use like below:
    <sid>adm@<host>:/usr/sap/<SID>/HDB02> hdbpersdiag -c 'check all' /hana/data/<SID>/mnt00001/hdb00001
    Loaded library 'libhdbunifiedtable'
    Loaded library 'libhdblivecache'
    Trace is written to: /usr/sap/<SID>/HDB02/<host>/trace
    Mounted DataVolume(s)
    #0 /hana/data/<SID>/mnt00001/hdb00001/ (8.2 GB, 8809873408 bytes)
    Tips:
    Type 'help' for help on the available commands
    Use 'TAB' for command auto-completion
    Use '|' to redirect the output to a specific command. Available command(s) are:
    count Count the number of lines
    dump Save the output to a file
    grep Print lines that contain a match for a pattern
    head Print the first n lines
    more Print text, one screen at a time
    tail Print the last n lines
    INFO: KeyPage loaded and decrypted with success
    Default Anchor Page OK
    Restart Page OK
    Default Converter OK
    RowStore Converter OK
    Logical Pages (308900 pages) OK
    Logical Pages Linkage OK
    ContainerDirectory OK
    ContainerNameDirectory OK
    FileIDMappingContainer OK
    UndoFileDirectory OK
    LOBContainerDirectory OK
    MidSizeLOBContainerDirectory OK
    LOBFileIDMappingContainer OK



If you encounter any corruption during above checks, report it to SAP via customer message for further troubleshooting and solution.

Recommendation for Production Systems


In a productive environment, if you want to to check the consistency of the persistence of a system, prefer an indirect approach by using backup-recovery into non-prod system:

  1. Take a new full backup of the system which you want to check.

  2. Recover the backup in a non-prod environment that you want to use for the check.

  3. Shut down the system that you have just recovered.

  4. Run hdbpersdiag for all data volumes (one-by-one) which you want to check:
    hdbpersdiag -c 'check all' <DATA_VOLUME_PATH>




2 Comments