Saturday, November 30, 2013

SHUTDOWN AND STARTUP OF ORACLE DATABASE WITH SHELL SCRIPTING


Shutdown Script.

Steps:-
1) --> vi shut.sh
2) --> copy below text in that file.
3) -->save and quit.
4) --> chmod 777 shut.sh

test now

sh shut.sh

#!/bin/bash

export ORACLE_SID=orcl
sqlplus "/as sysdba" << EOF
shutdown immediate;
exit;
EOF

export ORACLE_SID=+ASM
sqlplus "/as sysdba" << EOF
shutdown immediate;
exit;
EOF


Startup Script
Steps:-
1) vi start.sh
2) copy the following Text in the file
3) chmod 777 start.sh
4) save and quit

Test script now.

export ORACLE_SID=+ASM
sqlplus "/as sysdba" << EOF
startup;
exit;
EOF


export ORACLE_SID=orcl
sqlplus "/as sysdba" << EOF
startup;
exit;
EOF

Enjoy.