2025 Oct 01 7:42 AM - edited 2025 Oct 01 7:47 AM
Hello,
i want to use hdbsql in a shell script, to run a query for checking database backups. Unfortunately i am only able to login with hdbuserstorekey in my script after that the select statement does not work (select "command not found")
SAPSTRING=$(find /usr/sap/ccms -maxdepth 2 -type d -name sapccmsr | head -n 1 | cut -c 15-17)
HDBSTRING=$(/usr/bin/cat /usr/sap/"$SAPSTRING"/SYS/profile/DEFAULT.PFL | grep dbs/hdb/dbname | awk {' print$3'})
echo "HDB System ID ----------> " $HDBSTRING
declare -l HDBSIDADM
HDBSIDADM=$HDBSTRING'adm'
HDBBACKUPTEST=$(sudo su - "$HDBSIDADM" -c 'hdbsql -c ";" "\c -U HDBUSERSTOREKEY ";" select * from "SYS"."M_BACKUP_CATALOG" " ' )
this results in
-bash: select * from SYS.M_BACKUP_CATALOG : command not found
seems like that after the successful connect with hdbuserstorekey, it closes the connection and so the select command is not known.
any ideas?
thanks in advance
Request clarification before answering.
Hi @qwertie ,
In the past, I encountered similar errors. I resolved them by placing the hdbsql commands in a file and then calling it from the shell script.
I suggest you try this approach.
Best regards,
Charles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.