ANR2579E failed - return code 230

jamesmacd40

ADSM.ORG Member
Joined
Apr 17, 2018
Messages
67
Reaction score
3
Points
0
Hi

i have a schedule set up that runs a DB2 reclaim script that issues the following command
su - db2inst1 -c /home/db2inst1/tsm/db2_reclaim.ksh

the command runs ok when i issue it from the host (signed in as root), however when it is scheduled to run using the tsm scheduler, i get the error that it failed with the RC of 230

I cannot find anything on what the RC 230 means anywhere.

I checked permissions on the ksh script, db2inst1 has permission to it, in fact permission wise, it is the same as the db2_backup_full.ksh script, that runs fine on a TSM schedule also.

Anyone have any idea what RC 230 means?

thanks
 
For scheduled commands if using the tsm scheduler, the return code is the return code from the command that was run. Not much help I know. Any chance you can break it into smaller parts and check the result of each section?
 
Well, when i log into the box using root, i can issue the command and it will run without any errors. but as soon as i try to get the scheduler to run it, it fails.

I will try a few more things to see what i can figure out with it

thanks
 
Right, so you as root are running 'su - db2inst1 -c /home/db2inst1/tsm/db2_reclaim.ksh' no issues.
I've had some issues with AIX and ksh scripts from cron fail if a term wasn't exported.
I've gotten in the habit of doing something like this to all my scripts at the start.
Code:
TERM=vt100;export TERM
 
do you add that line at the top of the ksh script? what does it do exactly?
 
Yeah, for example it would be:
Code:
#!/bin/sh

TERM=vt100;export TERM
#rest of script goes here

What it does is set the running term type of the script to vt100.
 
It's probably scheduler service which needs to be started differently. Had the same problem and started the scheduler to run scripts like this:

nohup dsmc sched -optfile=/usr/tivoli/tsm/client/api/bin64/custom.opt >/dev/null 2>&1 < /dev/null &

Remove the part selecting the opt file if you don't need to use a different one.
 
I have the dsmcad running which invokes the scheduler - dsm.sys for each node has managedservices schedule webclient


ps -ef | grep dsmcad
root 8519798 1 0 Jan 16 - 0:00 /usr/tivoli/tsm/client/ba/bin64/dsmcad
root 10158152 1 0 Jan 16 - 0:00 /usr/tivoli/tsm/client/ba/bin64/dsmcad -optfile=/home/db2inst1/tsm/dsm.opt
root 10747992 1 0 Jan 16 - 0:00 /usr/tivoli/tsm/client/ba/bin64/dsmcad -optfile=/home/db2inst2/tsm/dsm.opt
root 12976336 6619378 0 06:57:54 vty0 0:00 grep dsmcad

THis server has the cad running for regular BA client OS level backup, 1 configured to run a DB2 backup against the databases in DB2INST1 and another for DB2INST2

the script to run the DB2 backups are ok

the ksh script for running the online backup is

#!/bin/ksh
#set -x

# The list of databases is taken from db2 -v 'LIST DATABASE DIRECTORY' command from the current DB2 instance

for i in `db2 -v 'LIST DATABASE DIRECTORY' | grep "Database name" | awk -F'=' '{ print $2}'` ;
do
echo backing up database $i ; db2 backup database $i online use tsm ;

if [[ $? -ne 0 ]] ;
then
logger db2 backup failed for $i database ;
# If you get this message - please check your TSM server
# This backup will fail if TSM server is not available
else
echo success ;
fi ;

done


This works fine

The script to reclaim old DB2 backups is this

#!/bin/ksh
# set -x

# KEEP_FULL is the number of full DB backups will be retained in TSM
# including all Archivelogs

KEEP_FULL=35

## Delete full DB backups and keep $KEEP_FULL
#
for DB in `db2 -v "LIST DATABASE DIRECTORY" | grep "Database name" | awk -F'=' '{ print $2 }'` ;
do
db2adutl delete full keep $KEEP_FULL db $DB without prompting
#
# This is the tricky part to determine the oldest logfilenumber
# We assume that the last image in the query output has the oldest log number
# We had to subtracte one from the oldest logfile in order to keep the
# last backup valid.
#
let OLDEST_LOG=$(db2adutl query full db $DB | grep Time: | tail -2 | awk '{print $3}' | cut -c2-8 )
let OLDEST_LOG=$(db2adutl query full db $DB | grep Time: | tail -1 | awk '{ print $6 }' | cut -c2-8)
let OLDEST_LOG=$OLDEST_LOG-1
echo OLDEST_LOG $OLDEST_LOG
OLD_LOG=$(printf "%-7.7d" $OLDEST_LOG)
OLD_LOG="S$OLD_LOG.LOG"
# Now delete obsolete logs
#
db2adutl delete logs between S0000000.LOG and $OLD_LOG db $DB without prompting
done

I think there is something off with the way the scheduler kicks off hte script, even though it is set up the exact same as the rest of the environments being backed up.
 
Very Odd, but i modified the script to change the keep_full from 35 to 8 (there were only 10 backups reporting in TSM, which lines up as the node was configured 10 days ago), the scheduled job ran, but reported failed again with same RC 230.
I took a look at the what TSM was now showing for that node ./db2adutl query, and the script actually worked and removed the oldest 2 DB2 backups for that instance.

So, i am not gonna worry too much about it, as long as the oldest backups are getting removed i am good with that.
 
Back
Top