Skip to main content
Pure Technical Services

Using hdbpersdiag to Check Storage Snapshot Consistency

The SAP HANA Persistence Diagnosis Tool (hdbpersdiag) is available in SAP HANA 2.0 SPS05 and onwards, capable of doing a full consistency check of page data in SAP HANA databases volumes. 

Previously consistency checks on SAP HANA Persistence page data could only be done by SAP support but with the release of SAP HANA 2.0 SPS05 organizations are now capable of running the tool themselves with the "check all" option to verify if there are any issues at the disk level. 

It is possible to use hdbpersdiag to check the consistency of an existing SAP HANA deployment without analyzing storage snapshots. That process can be done by shutting down the existing SAP HANA system and running the tool on the existing data volumes. 

SAP Note 2843934 - How to Check the Consistency of the Persistence details out how the persistence of a system could be checked indirectly by using a backup-recovery driven approach. 

This knowledgebase article will focus on checking storage snapshots for the following purposes:

  • Determine if a specified data snapshot would be an appropriate recovery point without any data volume consistency errors. 
  • Determine if a crash consistent storage snapshot is appropriate to be used as a recovery point without any data volume consistency errors, where data snapshots have not been created.
  • Determine if a recovery from a storage/data snapshot will contain additional complications such as data volume consistency errors. 

Important things to note before using the tool:

  • This is an expert tool where only the “check all” function is available for public use. 

  • The tool is delivered as apart of the SAP HANA 2.0 SPS05 Installation in the /usr/sap/<sid>HDB<instance number>/exe directory.

  • The tool is not standalone, it is dependent on binaries and environment variables in an SAP HANA deployment. 

  • It should be run by the <sid>adm user from a command line terminal or ssh connection.

Step 1. Copy the storage snapshots to new volumes and connect those volumes to the host with SAP HANA 2.0 SPS05 installed. 

 NewVolConnect.JPG

Step 2. Mount the volumes to a location in the filesystem. In this example/hana/testData will be used for the data volume persistence location.

if the system the volumes are being mounted to are the same as those the volumes' snapshots were created from then it may be necessary to use "nouuid" to mount the volumes to avoid filesystem UUID conflicts. 

Filesystem Size Used Avail Use% Mounted on
devtmpfs 2.3T 0 2.3T 0% /dev
tmpfs 3.4T 32K 3.4T 1% /dev/shm
tmpfs 2.3T 21M 2.3T 1% /run
tmpfs 2.3T 0 2.3T 0% /sys/fs/cgroup
/dev/mapper/3624a9370c49a4cb0e2944f440002d735-part2 60G 18G 43G 30% /
/dev/mapper/3624a9370c49a4cb0e2944f440002dc76 512G 44G 469G 9% /hana/shared
fileserver.puredoes.local:/mnt/nfs/HANA_Backup 1.0T 136G 889G 14% /hana/backup
tmpfs 454G 20K 454G 1% /run/user/469
tmpfs 454G 0 454G 0% /run/user/468
tmpfs 454G 0 454G 0% /run/user/0
/dev/mapper/3624a9370884890ea83bd488200012c64 7.0T 1.1T 6.0T 15% /hana/data
/dev/mapper/3624a9370884890ea83bd488200012c65 3.0T 673G 2.4T 22% /hana/log
tmpfs 454G 0 454G 0% /run/user/1001
/dev/mapper/3624a9370884890ea83bd488200012c6d 3.0T 673G 2.4T 22% /hana/testLog
/dev/mapper/3624a9370884890ea83bd488200012c6e 7.0T 1.1T 6.0T 15% /hana/testData

Step 3. Identify the HANA database volumes within the volume. With multiple tenants there will be multiple database volumes. Each folder starting with “hdb000x” is a HANA database volume. The tool is used to check the integrity of the SAP HANA data volume. 

sh1adm@Hannah:/hana/testData/SH1/mnt00001> ll
total 4
drwxr-x--- 2 sh1adm sapsys 117 Jul 13 06:36 hdb00001
drwxr-xr-- 2 sh1adm sapsys  93 Jul 14 06:43 hdb00002.00003
drwxr-xr-- 2 sh1adm sapsys  93 Jul 14 07:00 hdb00002.00004
-rw-r--r-- 1 sh1adm sapsys  17 Jul 14 07:06 nameserver.lck

Step 4. Run the hdbpersdiag tool to check for page data corruption on each HANA database volume. 

Test SystemDB Volume:

/usr/sap/SH1/HDB00/exe/hdbpersdiag  -c 'check all'  /hana/testData/SH1/mnt00001/hdb00001

Output:

Loaded library 'libhdbunifiedtable'
Loaded library 'libhdblivecache'
Trace is written to: /usr/sap/SH1/HDB00/hannah/trace
Mounted DataVolume(s)
  #0 /hana/testData/SH1/mnt00001/hdb00001/ (2.7 GB, 2904342528 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
                     Default Anchor Page OK
                            Restart Page OK
                 Default Converter Pages OK
                RowStore Converter Pages OK
             Logical Pages (64750 pages) OK
                   Logical Pages Linkage OK
                      ContainerDirectory OK
                  ContainerNameDirectory OK
                  FileIDMappingContainer OK
                       UndoFileDirectory OK
                            LobDirectory OK
                     MidSizeLobDirectory OK
                            LobFileIDMap OK

Test Tenant 1 Volume: 

/usr/sap/SH1/HDB00/exe/hdbpersdiag  -c 'check all'  /hana/testData/SH1/mnt00001/hdb00002.00003 

Test Tenant 2 Volume: 

/usr/sap/SH1/HDB00/exe/hdbpersdiag  -c 'check all'  /hana/testData/SH1/mnt00001/hdb00002.00004  

If the output has each section identified as "OK" then the snapshot is a good recovery point candidate, if there are any sections identified as having an issue please review SAP Note - 2116157 - FAQ: SAP HANA Consistency Checks and Corruptions or contact SAP support.