On Fri, Jun 26, 2009 at 2:51 PM, ashok abraham<[email protected]> wrote:
>
>
>

> my oracle database server has to ORACLE_SID
> ist ORACLE_SID=orcl
> 2nd ORACLE_SID=orclrew
>
> the server is on a production environment and will shutdown once or twice in
> a year currently id shutdown it
>
> assigning ORACLE_SID manually
>
> then i login to the server as user oracle
> issue the following command
>
> sqlplus /nolog
> shutdown immediate
>
> again assign the ORACLE_SID other value repeat the above process
>
> i wan to automate the shutdown process
>
> i create a script like the following
>
> #!/bin/bash
> clear
> echo "Shutting Down Oracle Server Please Be Patient "
> sleep 1
> echo "Kiling All Oracle Process"
> ps -ef | grep oracleorcl |cut -c 8-16 | sed -e '1,$s/^/kill -9 /g'>
> /tmp/killtmp.sh
> chmod +x /tmp/killtmp.sh
> sh +x /tmp/killtmp.sh

It is extremely unsafe to kill oracle processes like you are doing.
That too on a production database.
Why can't  you use something as simple as this:

#!/bin/bash
su - oracle
export ORACLE_SID=orcl
sqlplus / as sysdba <<EOF
shutdown immediate;
exit
EOF

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

exit 0


This is assuming both your instance are in the same oracle home.

Or, you can just use oracle's dbstop command, which reads the oracle
sids from /etc/oratab.
You also might need to stop the listener. (lsnrctl stop)

Regards,
NMK.

Reply via email to