首页 > 数据库技术 > 详细

关闭并卸载数据库脚本

时间:2017-12-13 01:32:23      阅读:222      评论:0      收藏:0      [点我收藏+]
!#/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    
    

 

关闭并卸载数据库脚本

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!