Skip to Content

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!

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. 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

    (0) 

Leave a Reply