cancel
Showing results for 
Search instead for 
Did you mean: 

Copy a database with backup and restore via command line

Former Member
0 Kudos

Hey folks,

I am trying to follow the steps outlined here: Copying a Database Using Backup and Recovery - SAP HANA Administration Guide - SAP Library


However, instead of using the HANA Studio to recover my 'target' system I would like to do it with the command line using the recoverSys.py script. 

Here is what I have tried:

HDBSettings.sh recoverSys.py --password mySuperStrongPassword --wait --command="RECOVER DATABASE UNTIL TIMESTAMP '2099-01-01 23:59:59' using DATA PATH ('/path/to/data/backup')"


When I do this - it still looks to the backup catalog of the target system.


How can I use recoverSys.py and specify a file backup for it to use, ignoring the backup catalog? We can do it from the HANA Studio so there must be a way to do it from the command line

Accepted Solutions (1)

Accepted Solutions (1)

former_member182967
Active Contributor
0 Kudos

Hello Lucas,

You can use Show SQL Statement function during recovery process to get the SQL.

Maybe your current command is not correct, you may still need to provide the log backup path.

RECOVER DATABASE - SAP HANA SQL and System Views Reference - SAP Library

Regards,

Ning

Answers (1)

Answers (1)

Former Member
0 Kudos

For anyone who is interested - I was able to get this working with the following command:


HDBSettings.sh recoverSys.py --password mySuperStrongPassword --wait --command="RECOVER DATA USING FILE ('/path/to/data/backup/backupPrefix') CLEAR LOG"


Where backupPrefix in the above command is the name of the file backup you would have created. The files would be called something like:


201604271033_databackup_0_1

201604271033_databackup_1_1

201604271033_databackup_2_1

201604271033_databackup_3_1


The only problem I have now (and I have no idea if it's as designed or not) is that I can't restore to a different HANA DB with a different instance number.

Former Member
0 Kudos

Hi Lucas,

what exact error you are getting ?

Former Member
0 Kudos

If you're referring to the error I get when trying to restore to a DB with an different instance number than the source system... I'm not sure of the exact message - I didn't take note of it. But it's something along the lines of a "port topology mismatch".