Tuesday, December 04, 2007

Oracle AS Startup & Shutdown script

Reference: http://terrencemiao.com/Webmail/msg00898.html

Environment File: infraenv
export ORACLE_SID=if
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/Infra101202
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/lib:/usr/lib:/usr/local/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:
$ORACLE_HOME/network/jlib
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:
$ORACLE_HOME/dcm/bin:$ORACLE_HOME/opmn/bin
export TNS_ADMIN=$ORACLE_HOME/network/admin

Start Script:
[oracle@host]$ cat start1012.sh
#1. Start Infra DB.
source infraenv
$ORACLE_HOME/bin/lsnrctl start

SQLDBA="$ORACLE_HOME/bin/sqlplus /nolog"
$SQLDBA <connect / as sysdba
startup
EOF

#2. Start Infra AS.
$ORACLE_HOME/opmn/bin/opmnctl start
$ORACLE_HOME/opmn/bin/opmnctl startproc
$ORACLE_HOME/bin/emctl startifdown iasconsole

#3. Start Midtier
source asenv
$ORACLE_HOME/opmn/bin/opmnctl start
$ORACLE_HOME/opmn/bin/opmnctl startproc
$ORACLE_HOME/bin/emctl startifdown iasconsole

Stop Script:
[oracle@host]$ cat stop1012.sh
#1. Stop Midtier
source asenv
$ORACLE_HOME/bin/emctl stop iasconsole
$ORACLE_HOME/opmn/bin/opmnctl stopproc
$ORACLE_HOME/opmn/bin/opmnctl shutdown

#2. Stop Infra AS
source infraenv
$ORACLE_HOME/bin/emctl stop iasconsole
$ORACLE_HOME/opmn/bin/opmnctl stopproc
$ORACLE_HOME/opmn/bin/opmnctl shutdown

#3. Stop DB.
SQLDBA="$ORACLE_HOME/bin/sqlplus /nolog"
$SQLDBA <connect / as sysdba
shutdown immediate
EOF

$ORACLE_HOME/bin/lsnrctl stop

No comments: