SAP HANA Academy: Backup and Recovery – Backup Catalog
The SAP HANA Academy has published a new video in the series SAP HANA SPS 7 Backup and Recovery.
Backup and Recovery – Backup Catalog | SAP HANA
In this video, we briefly introduce you how to work with the Backup Catalog and the monitoring views M_BACKUP_CATALOG and M_BACKUP_CATALOG_FILES.
This query, for examples, get’s you all the data and log backup files needed to recover using the latest backup
SELECT DESTINATION_PATH
FROM M_BACKUP_CATALOG_FILES
WHERE BACKUP_ID >= (SELECT TOP 1 BACKUP_ID
FROM M_BACKUP_CATALOG
WHERE STATE_NAME = 'successful'
AND ENTRY_TYPE_NAME = 'complete data backup'
ORDER BY UTC_START_TIME desc)
hdbbackupcheck
The main part of the tutorial video is about a new tool introduced with SAP HANA 1.0 SPS 7 (or revision 64 to be exact): hdbbackupcheck.
You can use the hdbbackupcheck tool to check (data or log) backup files for changes, e.g. after the files have been transferred from the database to an external backup tool. The tool imports the backup file, checks the metadata for correctness and consistency, and checks whether contents have changed.
hana:/usr/sap/DB1/HDB01> hdbbackupcheck -h
Usage: hdbbackupcheck [options] <backup> [-i <backupid>] [-e <ebid>]
Options:
-v: display all known information
–backintParamFile <filename>: use parameter file specified for a backint call
hana:/usr/sap/DB1/HDB01>
The tool is called with the data or log backup file as input and, optionally, a -v (erbose) flag for more detailed output. The file can be checked against a backup ID or, when using BACKINT, an external backup id (EBID).
The interesting aspect about this tool is that it can be used outside of the context of a SAP HANA installation on any SUSE Linux host.
hana:/usr/sap/DB1/HDB01/backup/log> cdexe
hana:/usr/sap/DB1/SYS/exe/hdb> hdbbackupcheckpack hdbcheck
a hdbbackupcheck
a libhdbbackup.so
a libhdbbasement.so
a libhdbbasis.so
a libhdbconfig.so
a libhdbcrypto.so
a libhdbcsbase.so
a libhdbdataaccess.so
a libhdblicensing.so
a libhdblttbase.so
a libhdbpersistence.so
a libhdbtransactionmanager.so
a libhdbunifiedtable.so
a libhdbunifiedtypes.so
a libhdbversion.so
a libicudata.so.46
a libicui18n.so.46
a libicuuc.so.46
a libirc.so
a libxmldom.so
hana:/usr/sap/DB1/SYS/exe/hdb> cp hdbcheck $HOME
hana:/usr/sap/DB1/SYS/exe/hdb> cd $HOME
hana:~> mkdir hdbcheckdir
hana:~> mv hdbcheck hdbcheckdir/
hana:~> cp $DIR_INSTANCE/exe/SAPCAR hdbcheckdir/
hana:~> cd hdbcheckdir
hana:~/hdbcheckdir> ll
total 145980
-rw-r—– 1 db1adm sapsys 145155119 2014-01-24 16:36 hdbcheck
-rwxr-x— 1 db1adm sapsys 4170776 2014-01-24 16:39 SAPCAR
hana:~/hdbcheckdir> ./SAPCAR -xvf hdbcheck
SAPCAR: processing archive hdbcheck (version 2.01)
x hdbbackupcheck
x libhdbbackup.so
x libhdbbasement.so
x libhdbbasis.so
x libhdbconfig.so
x libhdbcrypto.so
x libhdbcsbase.so
x libhdbdataaccess.so
x libhdblicensing.so
x libhdblttbase.so
x libhdbpersistence.so
x libhdbtransactionmanager.so
x libhdbunifiedtable.so
x libhdbunifiedtypes.so
x libhdbversion.so
x libicudata.so.46
x libicui18n.so.46
x libicuuc.so.46
x libirc.so
x libxmldom.so
SAPCAR: 20 file(s) extracted
hana:~/hdbcheckdir> export LD_LIBRARY_PATH=~/hdbcheckdir:$LD_LIBRARY_PATH
hana:~/hdbcheckdir> ./hdbbackupcheck
Usage: ./hdbbackupcheck [options] <backup> [-i <backupid>] [-e <ebid>]
Options:
-v: display all known information
–backintParamFile <filename>: use parameter file specified for a backint call
hana:~/hdbcheckdir>
The tool hdbbackupcheck is documented in the SAP HANA Administration Guide for SPS 7 and SAP Note 1869119
hdbbackupdiag
The other tool demonstrated, is hdbbackupdiag. In SPS 7 a new flag is introduced, which is somewhat confusingly called check, as it does not do what hdbbackupcheck does.
With flag –check, hdbbackupdiag checks if
- the location (file system) or external backup tool is correct
- the current operating system user has read authorization for the file
- the backup ID corresponds to the backup ID specified in the backup catalog
hana:~/hdbcheckdir> hdbbackupdiag -h
Usage: hdbbackupdiag [options] [-d <directory>] { -b <backup> | -c <backup catalog> }
Options:
–generate: generates a new backup catalog using data path given by –dataDir and log paths given by –logDirs options
–dump: dumps the content of the backup catalog
=== NEW in SPS 7 ===
–check: check for files using data path given by –dataDir and log paths given by –logDirs options
–useBackintForCatalog: search backup catalog in backint if –check is given
–backintDataParamFile <filename>: backint parameter file to use if –check is given
–backintLogParamFile <filename>: backint parameter file for log backups to use if –check is given
-i <backup_id>: check files beginning with given backup id
===
-f: display filenames only
-v: display all known information
-u “YYYY-MM-DD HH:MM:SS”: defines UNTIL timestamp in UTC
Notes:
if -d is not defined the current directory will be used otherwise the specified directory must be an absolute path
the specified backup_catalog or backup must be relative to current directory or the directory specified with -d
hana:~/hdbcheckdir>
Another usage for the hdbbackupdiag tool is the (re-)generation of the backup catalog (Note 1812057).
The tool hdbbackupidag is documented in the SAP HANA Administration Guide for SPS 7 and SAP Notes 1873247 and 1812057
SAP HANA Academy
Denys van Kempen
hi thanks for the blog.May I add this to theThe SAP Hana Reference for SAP Basis Administrators
Hello,
I have a problem with hdbbackupcheck, when I run the command "hanab1:/usr/sap/S00/HDB00/exe> ./hdbbackupcheck -h".
The console shows "./hdbbackupcheck: error while loading shared libraries: libhdbpersistence.so: cannot open shared object file: No such file or directory"
Can anyone help me?
Thanks.
Regards,
Alfonso
Hi Alfonso,
For this kind of questions, it is probably best to open a support ticket, so you can get a timely response.
In Linux, when shared object files (the equivalent of a Windows DLL) cannot be found the file(s) either does not exist (not installed) or is not in the $PATH of the user executing the command.
When you logon as the software owner of the HANA database, <sid>adm, the env.sh file will be sourced so all the environment variables (like $PATH) are set.
What user to use to run the command? Root?
Thank you for your attention, the problem is solved.
Thank you