码迷,mamicode.com
首页 > 数据库 > 详细

关闭并卸载数据库脚本

时间:2017-12-13 02:08:17      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:bin   and   oca   .sql   blog   post   syn   关闭   数据   

!#/bin/bash
echo -e "shutdown immdiate;\nexit">/tmp/shutdown.sql
su - oracle -c "sqlplus / as sysdba@/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    
    

 

关闭并卸载数据库脚本

标签:bin   and   oca   .sql   blog   post   syn   关闭   数据   

原文地址:http://www.cnblogs.com/yahutiaotiao/p/8030454.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!