cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HANA HDBSQL to execute SQL commands at OS level in background

SAPSupport
Employee
Employee
0 Kudos

Hi SAP, we would like to seek for your expertise regarding how we can execute HANASQL command in background via OS level. This is for the preparation of the incoming Online table partition.


------------------------------------------------------------------------------------------------------------------------------------------------
Learn more about the SAP Support user and program here.

Accepted Solutions (1)

Accepted Solutions (1)

SAPSupport
Employee
Employee
0 Kudos

Dear customer,

Hope you are doing well.

Just as this guide https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/6097e699826343d0879244185... mentioned: SAP HANA HDBSQL imports the commands from the specified file and processes them in the background, the SQL will not be canceled and will continue running in database after hdbsql is somehow terminated.

However you may not see any output after exit hdbsql, even if you have redirected the output to a file using -o command. If output values a lot, hdbsql needs to be run in background. Following is one of the solutions to achieve that.

Just like any other LINUX program, you may use nohup command to run the hdbsql in background and stop it from being killed when the session is terminated. Here is the format:

****************
nohup hdbsql -n <hostname>:<port> -u <username> -p <password> -i <instance_number> -m <<EOF > <a file name where output of the program will be put in> 2>&1 &

<put your sqls here, can be multiple lines, don’t forget semicolons>

EOF
****************

Also there is an example for you to better understand the format:

****************
nohup hdbsql -n server:30013 -u SYSTEM -p PASSWORD -i 00 -m <<EOF > output.txt 2>&1 &

Select * from DUMMY;

Select * from DUMMY;

EOF

****************

Best Regards,

Jay

 

=========================================================

Get answers quickly and conveniently! Try our brand new support services:

Expert Chat

Schedule an Expert

Guided Answers

=========================================================

 

Answers (0)