cancel
Showing results for 
Search instead for 
Did you mean: 

Database Backup using batch mode doesn't work

former_member184680
Participant
0 Kudos

Hello,

i try to use the batch mode to backup the HANA DB (1.00.21) but nothing happens.

my backup.sql

\connect -n <server name> -i <instance number> -u <user> -p <password>
//
BACKUP DATA USING FILE ('Monday')
//

excecute the backup

/usr/sap/<SID>/HDB<instance number>/exe/hdbsql -I backup.sql

The instructions work for themselves but with this script nothing happens.

Any ideas?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

tomas-krojzl
Active Contributor
0 Kudos

Hello,

you should not have connect part in sql script... you should provide this information when calling hdbsql...

/usr/sap/<SID>/HDB<instance number>/exe/hdbsql -n <server name> -i <instance number> -U <user> -I backup.sql

You should not provide password anywhere but rather have it stored in user store.

See explanation in this blog from Lars:

Tomas

former_member184680
Participant
0 Kudos

That's not the solution. I use the same way described in the blog and manual for backup.

Create a file backup.sql with the following content:
connect -n <server name> -i <instance number> -u <user> -p <password>
//
BACKUP DATA USING FILE ('Monday')
//
Store this file with read rights for the crontab user.
Execute the backup by calling the file backup.sql:
/usr/sap/<SID>/HDB<instance number>/exe/hdbsql -I backup.sql

The only difference is the missing backslash in the blog. The manual advises against your proposal rather, because the password is visible in the process.

Now I tried your proposal without the connect string in the file and with and without the slashes. Nothing happens.

tomas-krojzl
Active Contributor
0 Kudos

Hello,

The manual advises against your proposal rather, because the password is visible in the process.

Actually it is not advising against what I suggest and what it in the blog.

You have three options:

1.) run everything from command line (this is what SAP suggested that is wrong because you would see the password)

2.) store password in file - less wrong than option 1.) because everyone having access to file can see the password

3.) store password in encrypted user store and use just -U <user> (no password needed)

This is also suggested in guide:

In addition, the password must be saved in the hdbuserstore, and not in a file.

The issue is in separator - it is stated that default is '//' but apparently it is not - it is ';'.

This syntax would work:

\connect -n <server name> -i <instance number> -u <user> -p <password>;
BACKUP DATA USING FILE ('Monday');

Anyway - it is wrong from security perspective. User store is much better because the password is encrypted.

Tomas

former_member184680
Participant
0 Kudos

The issue is in separator - it is stated that default is '//' but apparently it is not - it is ';'.

That's it. That is not written in any document. Many thanks.

<edit>I found it in the Administratoru2019s Guide | Appendix C | Batch file<edit>

To the security: It is the first step to implement it in the easiest way to guarantee the function. The second step is to increase the security (use the user store).

Edited by: Patrick G. on Nov 23, 2011 8:19 PM

tomas-krojzl
Active Contributor
0 Kudos

Hello,

yes there is it mentioned correctly but if you do:

hdbsql -h

You will be told that default is '//'

Tomas

lbreddemann
Active Contributor
0 Kudos

Just to update this in this thread as well... with revision 18 the DEFAULT seperator was switched to ';' and in later versions reverted to ';' (looks like a simple mistake).

To ensure the usage of the seperator you use for your scripts simply specify the seperator you use in the hdbsql call:

 
hdbsql -U <userstore key> -c // ...

Where -c // specifies the seperator to be used.

regards,

Lars

former_member184680
Participant
0 Kudos

...and in later versions reverted to ';' (looks like a simple mistake).

We have updated to revision 21 and the default separator is still ";".

lbreddemann
Active Contributor
0 Kudos

Well, since I usually use internal weekstone builds that are about a week old or so it's a bit difficult for me to match this to the revisions that are available on the service marketplace.

As the default seperator setting isn't at all officially documented, it may be changed and switched without notice again - so the easiest way to ensure your scripts work will be to use -c parameter.

As explained in the blog you can always check on the current setting with -t - but why bother?

regards,

Lars

lbreddemann
Active Contributor
0 Kudos

Okay - another update on this

After I opened an SAP internal message on that to get either the default separator fixed or the documentation aligned, the later option was chosen by development.

Thus the most current releases have default separator ';' and the help output also contains this information.

I'm not going to change the blog post on this again (it was anyhow mainly targeted at getting the secure store for login data to use).

Best regards,

Lars

Answers (0)