Re: shutdown on AIX
Date: 1995/05/03
Message-ID: <Pine.SUN.3.91.950503094137.1710A-100000_at_seatimes>#1/1
On 1 May 1995, Mark Loth - DBA wrote:
> I'm currently automating the Oracle backup process on AIX thru cron. Unfortunately,
> I have not been able to write a script which successfully shuts down the database. There are multiple databases on this machine, and I have not been able to startup SQL*DBA with the proper SID thru cron.
I picked items out of the dbshut and dbstart routines to create my own scripts that are driven by an operator menu here. The scripts may be helpful to others (such as yourself) so....
ps I have the following other scripts also:
- dbarchive (tar and compress the archived redo logs with date time stamp)
- dbbackup (to tape with copies of the dbarchive files)
- dbexport (full database export with date/time stamp)
- dbimport (full database import allows cross region importing)
- shownkill (allows operators to kill users before dbshutdown)
But, here are the dbshutdown and dbstartup scripts:
------------dbshutdown----------------------------
#!/usr/bin/ksh
#
# dbshutdown {dbname}
#
# {dbname} specifies the database name [TST, PRD, DEV] to shutdown
#
# If {dbname} is not supplied, then it will
# default to value of $ORACLE_SID
#
typeset -u BASE typeset -l AREA BASE=${1-$ORACLE_SID}
AREA=$BASE
JULIAN=`date +"%j"`
LGDEST=/u03/ORA_LOG/$AREA/dbshutdown.$JULIAN
LOCALDTM=`date +"%m/%d/%y %H:%M:%S"`
echo "Starting database shutdown of '$BASE' at $LOCALDTM "
echo "Database shutdown of '$BASE' at $LOCALDTM " >> $LGDEST
ORACLE_BASE=/u02/home/oracle; export ORACLE_BASE ORACLE_SID=$BASE;export ORACLE_SID ORAENV_ASK=NO; . oraenv; ORAENV_ASK=""
sqldba << EOF
connect internal
shutdown immediate
EOF
LOCALDTM=`date +"%m/%d/%y %H:%M:%S"`
echo "Finished shutdown of '$BASE' at $LOCALDTM "
echo "Finished shutdown of '$BASE' at $LOCALDTM " >> $LGDEST
echo ......... >> $LGDEST
- end of dbshutdown -------------------
------------- dbstartup ------------------------------------
#!/usr/bin/ksh
#
# dbstartup {dbname}
#
# {dbname} specifies the database name [TST, PRD, DEV] to startup
#
# If {dbname} is not supplied, then it will
# default to value of $ORACLE_SID
#
typeset -u BASE typeset -l AREA BASE=${1-$ORACLE_SID}
AREA=$BASE JULIAN=`date +"%j"`
LGDEST=/u03/ORA_LOG/$AREA/dbstartup.$JULIAN
LOCALDTM=`date +"%m/%d/%y %H:%M:%S"`
echo "Beginning database startup of '$BASE' at $LOCALDTM "
echo "Database startup of '$BASE' at $LOCALDTM " >> $LGDEST
ORACLE_BASE=/u02/home/oracle; export ORACLE_BASE ORACLE_SID=$BASE;export ORACLE_SID ORAENV_ASK=NO; . oraenv; ORAENV_ASK=""
sqldba << EOF
connect internal
startup
EOF
LOCALDTM=`date +"%m/%d/%y %H:%M:%S"`
echo "Finished startup of '$BASE' at $LOCALDTM "
echo "Finished startup of '$BASE' at $LOCALDTM " >> $LGDEST
echo ......... >> $LGDEST
-------------------------------- end of dbstartup --------------- +----------------------------------------------------+ | Steve Butler Voice: 206-464-2998 | | The Seattle Times Fax: 206-382-8898 | | PO Box 70 Internet: sbut-is_at_seatimes.com | | Seattle, WA 98111 Packet: KG7JE_at_N6EQZ.WA | +----------------------------------------------------+All standard and non-standard disclaimers apply. All other sources are annonymous. Received on Wed May 03 1995 - 00:00:00 CEST