on 02-16-2007 1:45 PM
Hi , I have a My Sap ERP 2004 ECC 5.0 installed on SOLARIS platform. Now I need to take backup on weekends , can somebody give me a backup scripts which first stops SAP and then starts taking backup, using ufsdump command , Now the thing is that I have to login as user sapsid first to stop sap and when I use the script
su - cdvadm
stopsap
exit
su - oracdv
lsnrctl stop
exit
./backup
Here Backup is the name of the script that contains ufsdump commands, it executes just the first line of the script ie su - cdvadm and then stops and does not proceed further, can anybody help ?
Hi Mike
I have tried the same as u had suggested already but it is showing the same crontab file for both root as well as cdvadm so I am kinda confused, ny Idea about this is the crontab file common for all the users?
I know it sounds strange as I have also heard that every users has its own crontab
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karan,
I am assuming it expects you to type the password when it runs "su" (if you are not using root or equivalent to run it). I'd suggest you to use crontab (e.g. to schedule stopsap execution by cdvadm and then (let's say after 10 minutes) schedule "lsnrctl stop" (in the cron for oracdv). I'd also add checks to see if SAP/Oracle is really down and listener has been stopped before starting you backup script (you can do it analyzing "ps" output similar to "ps -ef | grep oracdv |wc -l" )
Regards,
Mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You really only need to stop the SAP database.
If you agree with this philosophy, then you can stop the SAP database with a shell script similar to this (HPUX commands):
initialize()
{
Define Oracle Environment
#
export ORACLE_SID=$1
Setup Oracle Environment
#
. /oracle/${ORACLE_SID}/utils/.dbenv_$
.ksh
#
export DBA_GROUP=`cat /oracle/$/.dbagroup`
#export DBA_GROUP="mr911080@aeraenergy.com"
Define Log File
#
export DT=`date +%Y%m%d`
Lowercase ORACLE_SID so that the log can write to the log directory
typeset -l LOWER_SID
LOWER_SID=$ export LOG_DIR=/export/`hostname`/$adm/backup_log export LOG_FILE=$LOG_DIR/db_sap_stop_$_$.log
echo "" > $LOG_FILE
Define time stamp
export datestamp=`date '+%m_%d_%y'`
Program and logfile identification messages
#
log_msg "/export/`hostname`/$adm/backup_script/maestro/db_sap_stop.ksh Started on `hostname` on `date`"
log_msg "Log File: $
"
log_msg "`date`"
#
DAYS_KEPT=30
}
#
log_msg()
{
echo "$1"
echo "\n$1" >> $LOG_FILE
}
#
log_severe_msg()
{
log_msg "$1"
mailx -s "${1}" $DBA_GROUP <<EOF
`cat $LOG_FILE`
EOF
}
#**************************************************************************
#**************************************************************************
#
if [ $# -ne 1 ]; then
echo "Usage: db_sap_stop.ksh ORACLE_SID"
exit 1
fi
#
initialize $1
#
. $HOME/.sapenv_`hostname`.sh
. $HOME/.profile
stopsap
if [ $? -eq 0 ]; then
log_msg "$ORACLE_SID on `hostname` and the SAP Application was successfully shutdown on `date`"
else
log_severe_msg "Severe Error: $ Database or SAP Application Failed to Shutdown"
exit 1
fi
Purge log files older than 30 days
#
find $LOG_DIR -name "db_sapstop*.log" -mtime +$DAYS_KEPT -print -exec rm {} \; >> $LOG_FILE
This was writtin on HPUX, so some commands will differ, but you get the idea.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.