Есть задача по резервированию БД под AIX. Из под пользователя db2inst1 при помощи crontab -e завел 2 задачи. 2 скрипта bash один резервирует БД online, с ним все в порядке. Второй резервирует БД-x offline. С ним как раз проблема в логе пишет (т.е. почему-то выполняется из под root):
Date is: 2016-05-23:01:00:00
------DB SMDB is being backed up on: 2016-05-23:01:00:05 -----
Database Connection Information
Database server = DB2/AIX64 9.7.7
SQL authorization ID = ROOT
Local database alias = SMDB
SQL1092N "ROOT" does not have the authority to perform the requested command
or operation.
DB20000I The TERMINATE command completed successfully.
db2 backup database SMDB to /dbbackup/db without prompting
SQL1092N "ROOT" does not have the authority to perform the requested command
or operation.
Сам скрипт offline_bkp.sh
#!/bin/bash
#set -x
BACKUPDIR=/dbbackup/db
LOGDIR=/LOG
DATE=/$(date +%d%m%Y)
BACKUPILES=$BACKUPDIR/*
LOGFILE=$BACKUPDIR$LOGDIR$DATE.offline.log
DBLIST=("SMDB")
touch $LOGFILE
echo Date is: `date +%Y-%m-%d:%H:%M:%S` >$LOGFILE
for index in ${!DBLIST[*]}
do
echo "------DB ${DBLIST[$index]} is being backed up on:" `date +%Y-%m-%d:%H:%M:%S` "-----" >> $LOGFILE
/opt/IBM/db2/v9.7/bin/db2 connect to ${DBLIST[$index]} >> $LOGFILE
/opt/IBM/db2/v9.7/bin/db2 quiesce database immediate force connections >> $LOGFILE
/opt/IBM/db2/v9.7/bin/db2 terminate >> $LOGFILE
echo db2 backup database ${DBLIST[$index]} to $BACKUPDIR without prompting >> $LOGFILE
/opt/IBM/db2/v9.7/bin/db2 backup database ${DBLIST[$index]} to $BACKUPDIR without prompting >> $LOGFILE
/opt/IBM/db2/v9.7/bin/db2 connect to ${DBLIST[$index]} >>$LOGFILE
/opt/IBM/db2/v9.7/bin/db2 unquiesce database >>$LOGFILE
/opt/IBM/db2/v9.7/bin/db2 terminate >>$LOGFILE
echo "------DB ${DBLIST[$index]} is end backed up on date:" `date +%Y-%m-%d:%H:%M:%S` " ------" >> $LOGFILE
done
#set +x
Настройка crontab (из под пользователя db2inst1):
bash-4.2$ crontab -l
10 0 * * * /home/db2inst1/scripts/offline_bkp.sh
30 0 * * * /home/db2inst1/scripts/online_bkp.sh