How-to: Linux: Oracle Application Server Startup/Shutdown Script


In my field of work as an Oracle DBA, it is quite important to have scripts which are easy for the end customer to startup and shutdown their Oracle Application Server 10g.

Login into the application server as oracle user on a terminal:

cd /home/oracle/

mkdir -p scripts

mkdir -p scripts/oas

vi /home/oracle/scripts/oas/stopdb.sql

shutdown immediate
quit

:wq

vi /home/oracle/scripts/oas/startdb.sql

startup
quit

:wq

vi /home/oracle/scripts/oas/settings.conf   —- This is the only file you need to modify!!

#Infrastructure Home Directory
INFRA=/u01/app/oracle/inf

#Instance Home Directory
INS=/u01/app/oracle/ins
ORACLESID=orclrep

vi /home/oracle/scripts/oas/startinfra.sh

source /home/oracle/scripts/oas/settings.conf
export ORACLE_HOME=$INFRA
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH
export ORACLE_SID=$ORACLESID
lsnrctl start
sqlplus / as sysdba @./oas/startdb.sql
opmnctl startall
emctl start iasconsole

vi /home/oracle/scripts/oas/startins.sh

source /home/oracle/scripts/oas/settings.conf
export ORACLE_HOME=$INS
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH
export ORACLE_SID=$ORACLESID
opmnctl startall
emctl start iasconsole

vi /home/oracle/scripts/oas/stopins.sh

source /home/oracle/scripts/oas/settings.conf
export ORACLE_HOME=$INS
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH
export ORACLE_SID=$ORACLESID
emctl stop iasconsole
opmnctl stopall

vi /home/oracle/scripts/oas/stopinfra.sh

source /home/oracle/scripts/oas/settings.conf
export ORACLE_HOME=$INFRA
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH
export ORACLE_SID=$ORACLESID
emctl stop iasconsole
opmnctl stopall
sqlplus / as sysdba @./oas/stopdb.sql
lsnrctl stop

vi /home/oracle/scripts/startas.sh

./oas/startinfra.sh
./oas/startins.sh

vi /home/oracle/scripts/stopas.sh

./oas/stopins.sh
./oas/stopinfra.sh

chmod -R 755 /home/oracle/scripts/

You can now run ./startas.sh or ./stopas.sh to either start or stop the application server.

Why all those files? I could have done it in a single sh file, well.. code reuse : )

Good Day

Gulshan Yashveer Beejan

Gulshan holds a BSc(Hons) Computer Science with Distributed systems from the City University of London. He is currently working at DSOGroup(Mauritius) as a Linux Administrator on SaaS Solutions. More about Gulshan

One thought on “How-to: Linux: Oracle Application Server Startup/Shutdown Script

Leave a Reply

Your email address will not be published. Required fields are marked *