Hi All,
I'm attempting to force application via script. I get a message stating completed. When I attempt to backup the DB, I get a get a SQLSTATE error. I am very new to db2. If anyone has any suggestions, they would be most welcome.
Error...
FORCING APPLICATION TO CLOSE...
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.
BEFORE SLEEP MODE 15 SECONDS...
SLEEP CYCLE IS COMPLETE. MOVING ON TO BACKUP...
BACKUP PROCESS STARTED...
SQL1035N The database is currently in use. SQLSTATE=57019
BACKUP PROCESS COMPLETED...
building file list ... done
Code...
#!/usr/bin/ksh
#echo Started back up on `date` > /db2_backup/timer.txt
dbname=campmor5
if [ "$dbname" = "" ]
then
echo "Usage : " $0 "<dbname>"
exit
fi
listcmd="db2 list applications for database $dbname"
$listcmd
printf '%s %s\n' "DEACTIVATING CAMPMOR5 DATABASE... $dbname"
db2 deactivate database $dbname
$listcmd | tail +5 | nawk '{print $3}' | while read applid
do
if [ "$applid" != "" ]
then
printf '%s %s\n' "FORCING APPLICATION TO CLOSE..."
#db2 "force application($applid)"
db2 force application all
fi
done
printf '%s %s\n' "BEFORE SLEEP MODE 15 SECONDS..."
#Snoozing for 5 seconds...
sleep 15
printf '%s %s\n' "SLEEP CYCLE IS COMPLETE. MOVING ON TO BACKUP..."
#Backing up DB...
printf '%s%s\n' "BACKUP PROCESS STARTED..."
db2 backup database campmor5 to /export/home/db2inst1/db2_backup
printf '%s %s\n' "BACKUP PROCESS COMPLETED..."
##SSH file to George..
rsync -a -e ssh -v /export/home/db2inst1/db2_backup db2inst1@enolagay:/export/home/db2inst1/db2_backup
#Checking for successful file transfer...
if ! rsync -a -e ssh -v /export/home/db2inst1/db2_backup db2inst1@enolagay:/export/home/db2inst1/db2_backup
then
echo "CAMPMOR DATABASE BACKUP FAILED" >> /db2_backup/timer.txt
print "CAMPMOR DATABASE BACK UP FAILED"
print "CHECK /EXPORT/HOME/DB2INST1/BACKUPCAMPMOR FOR BACKUP EXISTENCE."
exit 1
fi
#echo Back up completed on `date` >> /db2_backup/timer.txt
#echo --------------------------------------------------- >> /db2_backup/timer.txt
#exit
TIA,
T
I'm attempting to force application via script. I get a message stating completed. When I attempt to backup the DB, I get a get a SQLSTATE error. I am very new to db2. If anyone has any suggestions, they would be most welcome.
Error...
FORCING APPLICATION TO CLOSE...
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.
BEFORE SLEEP MODE 15 SECONDS...
SLEEP CYCLE IS COMPLETE. MOVING ON TO BACKUP...
BACKUP PROCESS STARTED...
SQL1035N The database is currently in use. SQLSTATE=57019
BACKUP PROCESS COMPLETED...
building file list ... done
Code...
#!/usr/bin/ksh
#echo Started back up on `date` > /db2_backup/timer.txt
dbname=campmor5
if [ "$dbname" = "" ]
then
echo "Usage : " $0 "<dbname>"
exit
fi
listcmd="db2 list applications for database $dbname"
$listcmd
printf '%s %s\n' "DEACTIVATING CAMPMOR5 DATABASE... $dbname"
db2 deactivate database $dbname
$listcmd | tail +5 | nawk '{print $3}' | while read applid
do
if [ "$applid" != "" ]
then
printf '%s %s\n' "FORCING APPLICATION TO CLOSE..."
#db2 "force application($applid)"
db2 force application all
fi
done
printf '%s %s\n' "BEFORE SLEEP MODE 15 SECONDS..."
#Snoozing for 5 seconds...
sleep 15
printf '%s %s\n' "SLEEP CYCLE IS COMPLETE. MOVING ON TO BACKUP..."
#Backing up DB...
printf '%s%s\n' "BACKUP PROCESS STARTED..."
db2 backup database campmor5 to /export/home/db2inst1/db2_backup
printf '%s %s\n' "BACKUP PROCESS COMPLETED..."
##SSH file to George..
rsync -a -e ssh -v /export/home/db2inst1/db2_backup db2inst1@enolagay:/export/home/db2inst1/db2_backup
#Checking for successful file transfer...
if ! rsync -a -e ssh -v /export/home/db2inst1/db2_backup db2inst1@enolagay:/export/home/db2inst1/db2_backup
then
echo "CAMPMOR DATABASE BACKUP FAILED" >> /db2_backup/timer.txt
print "CAMPMOR DATABASE BACK UP FAILED"
print "CHECK /EXPORT/HOME/DB2INST1/BACKUPCAMPMOR FOR BACKUP EXISTENCE."
exit 1
fi
#echo Back up completed on `date` >> /db2_backup/timer.txt
#echo --------------------------------------------------- >> /db2_backup/timer.txt
#exit
TIA,
T