Skip to Content
Author's profile photo Former Member

backup IQ via shell script

Hello guys.

Could you help me in a backup shell script sybase iq V16?

I have a backup shell script backup.sh:

##

porta=5000

DT=`date +%Y%m%d_%H:%M:%S`

user=DBA

passw=mypassw

for DBN in databasenameiq

do

DIRBKP=/backups/$DBN

cd $DIRBKP

dbisql -c “UID=$user;PWD=$passw;DBN=$DBN” -host 10.x.xxx.xx -port $porta -nogui <<EOF

backup database to ‘$DIRBKP/databasenameiq_$DT’;

exit;

EOF

#

$DIRBKP/gzip databasenameiq_$DT

done

~

~

And then, I run:

>ksh -x backup.sh

The result is:

+ porta=5000

+ + date +%Y%m%d_%H:%M:%S

DT=20160212_16:10:29

+ user=DBA

+ passw=mypassw

+ DIRBKP=/backups/databasenameiq

+ cd /backups/databasenameiq

+ dbisql -c UID=DBA;PWD=mypassw;DBN=databasenameiq -host 10.x.xxx.xx -port 5000 -nogui

+ 0<<

backup database to ‘/backups/databasenameiq_20160212_16:10:29’;

exit;

(DBA)> Snapshot created.

Execution time: 2,512 seconds

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)>

(DBA)> …..

…….

The exit command does not work, it seems that the execution is in loop.

Someone could tell me what’s wrong?

Thanks!

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Milind Potdar
      Milind Potdar

      Replace

      dbisql -c "UID=$user;PWD=$passw;DBN=$DBN" -host 10.x.xxx.xx -port $porta -nogui <<EOF

      backup database to '$DIRBKP/databasenameiq_$DT';

      exit;

      EOF

      With

      cat > backup.sql <<EOF

      backup database to '$DIRBKP/databasenameiq_$DT';

      exit;

      EOF

      dbisql -c "UID=$user;PWD=$passw;DBN=$DBN" -host 10.x.xxx.xx -port $porta -nogui backup.sql

      Author's profile photo Roland Kramer
      Roland Kramer

      Hi
      the SAP First Guidance Document for the Implementation of the SAP-NLS Solution contains an example script for backup/restore of a SAP IQ database.

      Best Regards Roland