关闭并卸载数据库脚本

Posted 雅虎跳跳

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关闭并卸载数据库脚本相关的知识,希望对你有一定的参考价值。

!#/bin/bash
echo -e "shutdown immdiate;\nexit">/tmp/shutdown.sql
su - oracle -c "sqlplus / as [email protected]/tmp/shutdown.sql"

if [ $? -eq 0 ]
then
    echo "shutdown oracle successful!"
    rm -rf /tmp/shutdown.sql
fi

read -p "Are you sure to unistall the Oracle and reboot the system?(Please enter ‘y‘ or ‘n‘):" flag

if [ "$flag"=="y" -o "$flag"=="Y" ]
then
    rm -rf /opt/oracle
    rm -rf /etc/ora*
    rm -rf /user/local/bin/*oraenv
    rm -rf /tmp/*Oracle*
    rm -rf /tmp/Oracle*
    userdel oracle
    rm -rf /home/oracle
    groupdel dba
    droupdel oinstall
    sync
    sync
    sync
    shutdown -r -t time now
else
    echo "Cancel unistall the Oracle ..."
    exit 0
fi    
    

 

以上是关于关闭并卸载数据库脚本的主要内容,如果未能解决你的问题,请参考以下文章