HANA database backup view and restore
1. Check the trace file
Cat backup.log | grep "/ usr/sap/HEQ/HDB00/backup/data/"
two。 Check catalog through studio
3. View view M_BACKUP_CATALOG-complete data backup/incremental data backup/differential data backup
Select * from "M_BACKUP_CATALOG" where ENTRY_TYPE_NAME = 'complete data backup' and state_name='successful' order by sys_start_time desc ENTRY_ID,ENTRY_TYPE_NAME,BACKUP_ID,SYS_START_TIME,UTC_START_TIME,SYS_END_TIME,UTC_END_TIME,STATE_NAME,COMMENT,MESSAGE,SYSTEM_ID1479879019957, "complete data backup", 1479879019957, "201611-23 1315119,957000000", "201611-230550540119,957000000", "201611-23 134714453000000", "201611-2305474724234", "1479874724234" "complete data backup", 1479874724234, "2016-11-23 12V 18V 44.234000000", "2016-11-23 0418V 44.234000000", "2016-11-23 1233V 37.222000000", "successful", "1479872660066,"1479872660066", "2016-11-2311R 4420.066000000", "2016-11-23031420.066000000" Successful, "1479870313939," complete data backup "," 1479870313939 "," 2016-11-23 0313313939 "," 2016-11-23 0314000000 "," 2016-11-23 0314000000 "," 2016-11-230322 "28.214000000", "successful", "1479869176913", "complete data backup" 1479869176913, "2016-11-23 10 purl 46purl 16.913000000", "2016-11-23 02 Vera 46purl 16.913000000", "2016-11-23 11 Vera 03Vera 19.029000000", "successful", "1479800886690,"complete data backup", 1479800886690, "2016-11-22 1514-48Rod 06.69000000000", "2016-11-22 0774 48Rod 06.690000000", "2016-11-22 163ROR 025.023000000" "2016-11-22 08successful", "successful", "1479110498231", "1479110498231", "1479110498231", "2016-11-14 1608140", "1479110498231", "1479110498231", "2016-11-140816"
4. If you want to check whether a backup can be done by OK
Hdbbackupcheck backup_filename
Heqadm@ECQ:/usr/sap/HEQ/HDB00/backup/data/dbsqlbackup > hdbbackupcheck 2016-11-23.complete_databackup_0_1Backup'/ hana/shared/HEQ/HDB00/backup/data/dbsqlbackup/2016-11-23.completedatabase upstream databases 0,1' successfully checked.heqadm@ECQ:/usr/sap/HEQ/HDB00/backup/data/dbsqlbackup >
Hdbbackupcheck-v backup_filename plus v view details
Restoring the database can be done through studio. The following is the command line restore process:
1.To call recoverSys.py, enter the statement in the following format: HDBSettings.sh recoverSys.py
[]
If you run HDBSettings.sh recoverSys.py without any parameters, recoverSys.py performs a
Recovery to the most recent point in time
Delete a data file while HDB is running and do a default restore
Heqadm@ECQ:/usr/sap/HEQ/SYS/global/hdb/data/mnt00001/hdb00003 > rm-rf datavolume_0000.datheqadm@ECQ:/usr/sap/HEQ/HDB00/eccqas/trace > HDBSettings.sh recoverSys.py [140219726718720,0.002] > > starting recoverSys (at Thu Nov 24 09:20:08 2016) [140219726718720,0.002] args: () [140219726718720,0.002] keys: {} own pid: 27909recoverSys started: 09:20:08 testing master: eccqaseccqas is mastershutdown database Timeout is 120stop system stop system: eccqasstopping system: 2016-11-24 09:20:08 stopped system: 2016-11-24 09:20:59 creating file recoverInstance.sqlrestart databaserestart master nameserver: 2016-11-24 09:21:04 start system: eccqas2016-11-24T09:21:14+08:00 P028061 15893ec1ad5 INFO RECOVERY state of service: nameserver, eccqas:30001, volume: 1, RecoveryExecuteTopologyAndSSFSRecoveryFinishedrecoverSys finished successfully: 2016-11-24 09:21:15 [140219726718720, 66.334] 0 [140219726718720] 66.334] sapcontrol-nr 00-function GetProcessList24.11.2016 09:41:56GetProcessListOKname, description, dispstatus, textstatus, starttime, elapsedtime, pidhdbdaemon, HDB Daemon, GREEN, Running, 2016 11 24 09:21:05, 0:20:51, 28043hdbcompileserver, HDB Compileserver, GREEN, Running, 2016 11 24 09:21:16, 0:20:40, 28131hdbindexserver, HDB Indexserver, GREEN, Running, 2016 11 24 09:21:22, 0:20:34, 28200hdbnameserver, HDB Nameserver, GREEN, Running, 2016 11 24 09:21:06 HDB Preprocessor, GREEN, Running, 2016 11 24 09:21:16, 0:20:40, 28134hdbwebdispatcher, HDB Web Dispatcher, GREEN, Running, 2016 11 24 09:41:20, 0:00:36, 28635hdbxsengine, HDB XSEngine, GREEN, Running, 2016 11 24 09:21:22, 0:20:34, 28202heqadm@ECQ:/usr/sap/HEQ/HDB00/eccqas/trace > 2. Specify the file, the previous backup command is: "backup data using file ('$date.complete')"
So the command to restore is: RECOVER DATA USING file ('2016-11-23.complete')
Heqadm@ECQ:/usr/sap/HEQ/SYS/global/hdb/data/mnt00001/hdb00003 > HDBSettings.sh recoverSys.py-- command= "RECOVER DATA USING file ('2016-11-23.complete') CLEAR LOG" [139945440958208,0.002] > > starting recoverSys (at Thu Nov 24 11:28:56 2016) [139945440958208,0.002] args: () [139945440958208 0.002] keys: {'command': "RECOVER DATA USING file (' 2016-11-23.complete') CLEAR LOG"} own pid: 30597recoverSys started: 2016-11-24 11:28:56 testing master: eccqaseccqas is mastershutdown database Timeout is 120stop system stop system: eccqasstopping system: 2016-11-24 11:28:56 stopped system: 2016-11-24 11:28:56 creating file recoverInstance.sqlrestart databaserestart master nameserver: 2016-11-24 11:29:01 start system: eccqas2016-11-24T11:29:11+08:00 P030717 15894613fe1 INFO RECOVERY state of service: nameserver, eccqas:30001, volume: 1, RecoveryExecuteTopologyAndSSFSRecoveryFinishedrecoverSys finished successfully: 2016-11-24 11:29:11 [139945440958208,15.490] 0 [139945440958208,15.491]
The CLEAR LOG option prevents the recovery of entries from the log area. No log entries from the log area are replayed, and the log area is initialized. As a consequence, the content of the log area is lost.
If they are needed, the log entries from the log backups are replayed.
CLEAR LOG must be used in the following situations:
The log area is unusable.
You are recovering the database to a different system.
The CLEAR LOG command corresponds to the Initialize log area option in SAP HANA studio.
3. See which point in time you can restore to
1821207-Determining required recovery files
1705945-Determining required restoration files
Heqadm@ECQ:/hana/shared/HEQ/HDB00/backup/data/dbsqlbackup > hdbbackupdiag-f-d / hana/shared/HEQ/HDB00/backup/log/found backup catalog 1479887651122 from file / hana/shared/HEQ/HDB00/backup/log/log_backup_0_0_0_0.1479887651122using backup catalog 1479887651122 from file / hana/shared/HEQ/HDB00/backup/log/log_backup_0_0_0_0.14798876511222016-11-23.complete_databackup_0_12016-11-23.increment database Incremental_0_1479887451566_0_12016-11-23.complete_databackup_1_12016-11-23.increment_databackup_incremental_1479879019957_1479887451566_1_12016-11-23.complete_databackup_2_12016-11-23.increment_databackup_incremental_1479879019957_1479887451566_2_12016-11-23.complete_databackup_3_12016-11-23.Increment database upwards increment 14798790199571log backupwards 1167788888 1679488.147988764897777logupwards 2percent 11973184 _ 11976576.1479887565796log_backup_3_0_4965350720_4965451904.1479887545567heqadm@ECQ:/hana/shared/HEQ/HDB00/backup/data/dbsqlbackup > heqadm@ECQ:/hana/shared/HEQ/HDB00/backup/data/dbsqlbackup > hdbbackupdiag-d / hana/shared/HEQ/HDB00/backup/data/dbsqlbackup-b 2016-11-23.complete_databackupBackup file: / hana/shared/HEQ/HDB00/backup/data/dbsqlbackup/2016-11-23.complete_databackup_0_1Backup time: 2016-11-23T13:30:21+08: 00Backup file: / hana/shared/HEQ/HDB00/backup/data/dbsqlbackup/2016-11-23.complete_databackup_2_1Backup time: 2016-11-23T13:30:21+08:00RedoLogPosition: 11925379Backup file: / hana/shared/HEQ/HDB00/backup/data/dbsqlbackup/2016-11-23.complete_databackup_1_1Backup time: 2016-11-23T13:30:21+08:00RedoLogPosition: 1652418Backup file: / hana/shared/HEQ/HDB00/backup/data/dbsqlbackup/2016-11-23.complete_databackup _ 3_1Backup time: 2016-11-23T13:30:21+08:00RedoLogPosition: 4942939522heqadm@ECQ:/hana/shared/HEQ/HDB00/backup/data/dbsqlbackup >-rw-r- 1 heqadm sapsys 6483968 Nov 23 15:54 log_backup_3_0_4965350720_4965451904.1479887545567heqadm@ECQ:/usr/sap/HEQ/HDB00/backup/log > HDBSettings.sh recoverSys.py-- command= "RECOVER DATABASE UNTIL TIMESTAMP '2016-11-23 15 purge 54ve00' CLEAR LOG" [140447315224320 0.002] > starting recoverSys (at Thu Nov 24 14:11:26 2016) [140447315224320, 0.002] args: () [140447315224320, 0.002] keys: {'command': "RECOVER DATABASE UNTIL TIMESTAMP' 11-23 15 keys 5400 'CLEAR LOG"} own pid: 6290recoverSys started: 11-24 14:11:26 testing master: eccqaseccqas is mastershutdown database Timeout is 120stop system stop system: eccqasstopping system: 2016-11-24 14:11:26 stopped system: 2016-11-24 14:11:26 creating file recoverInstance.sqlrestart databaserestart master nameserver: 2016-11-24 14:11:31 start system: eccqas2016-11-24T14:11:41+08:00 P006410 15894f606ef INFO RECOVERY state of service: nameserver, eccqas:30001, volume: 1, RecoveryExecuteTopologyAndSSFSRecoveryFinishedrecoverSys finished successfully: 2016-11-24 14:11:42 [140447315224320, 15.485] 0 [140447315224320, 15.485]
You can specify directories for backups and logs
Heqadm@ECQ:/usr/sap/HEQ/HDB00 > HDBSettings.sh recoverSys.py-- command= "RECOVER DATABASE UNTIL TIMESTAMP '2016-11-23 15 RECOVER DATABASE UNTIL TIMESTAMP' CLEAR LOG USING DATA PATH ('/ usr/sap/HEQ/HDB00/backup/data/dbsqlbackup/backup/') USING LOG PATH ('/ usr/sap/HEQ/HDB00/backup/log/')" [140659884533504, 0.002] > starting recoverSys (at Thu Nov 24 16:22:37 2016) [140659884533504, 0.002] args: () [140659884533504 0.002] keys: {'command': "RECOVER DATABASE UNTIL TIMESTAMP' 2016-11-23 15 CLEAR LOG USING DATA PATH 54CLEAR LOG USING DATA PATH ('/ usr/sap/HEQ/HDB00/backup/data/dbsqlbackup/backup/') USING LOG PATH ('/ usr/sap/HEQ/HDB00/backup/log/')"} own pid: 15906recoverSys started: 2016-11-24 16:22:37 testing master: eccqaseccqas is mastershutdown database Timeout is 120stop system stop system: eccqasstopping system: 2016-11-24 16:22:37 stopped system: 2016-11-24 16:22:37 creating file recoverInstance.sqlrestart databaserestart master nameserver: 2016-11-24 16:22:42 start system: eccqas2016-11-24T16:22:52+08:00 P016026 158956e207b INFO RECOVERY state of service: nameserver, eccqas:30001, volume: 1, RecoveryExecuteTopologyAndSSFSRecoveryFinishedrecoverSys finished successfully: 2016-11-24 16:22:53 [140659884533504, 16.000] 0 [140659884533504, 16.000]