!#/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