Problems Backing Up 2 DBs With Cron

jgraul

Active Newcomer
Joined
Feb 17, 2012
Messages
36
Reaction score
0
Points
0
I have a Linux server with DB2 9.7. There are two databases running. I've created scripts to stop the applications and backup the databases using the API then restart the applications. This works great interactively, but when running them from cron, I am getting SQL1035N The database is currently in use. SQLSTATE=57019. What's the difference in running them from cron and interactively? I put a symbolice link to the script in the cron.daily directory. Here's a copy of the db2 backup script:

#!/bin/bash
# DB2 Server Name: npsetl000_db2
#
logfile=/opt/tivoli/tsm/client/api/log/db2full.log
echo "------------------------------------------" >> $logfile
date >> $logfile
#

echo "---- Forcing all users off of database ---" >> $logfile
db2 connect to IADB >> $logfile
db2 quiesce database immediate force connections >> $logfile
db2 connect reset >> $logfile
echo "---- Backing up Database IADB -------------" >> $logfile
db2 backup db IADB use TSM >> $logfile
db2 connect to IADB >> $logfile
db2 unquiesce database >> $logfile
db2 connect reset >> $logfile
echo "------------------------------------------" >> $logfile

echo "---- Forcing all users off of database ---" >> $logfile
db2 connect to XMETA >> $logfile
db2 quiesce database immediate force connections >> $logfile
db2 connect reset >> $logfile
echo "---- Backing up Database XMETA ------------" >> $logfile
db2 backup db XMETA use TSM >> $logfile
db2 unquiesce database >> $logfile
db2 connect reset >> $logfile
echo "-----------------------------------------" >> $logfile
 
Ok, so does anyone backup multiple DB2 databases on the same server?
 
Back
Top