参考文档:
Linux环境下11.2.0.3 rac的快速卸载脚本
在Oracle 11.1和Oracle 10.1,10.2上,都是官方提供手工清理RAC环境的方法的(比如环境有问题,或者RAC安装失败,要清理后重新安装。虽然这些版本,也提供了卸载脚本,但是总是卸不干净,因此那个时候,更多的这种需求都是通过手工卸载完成的)。
从11.2开始,Oracle不推荐使用手工方式删除RAC环境,而是提供重新配置的脚本和专门的卸载包。
方案一、使用重新配置的脚本和专门的卸载包
卸载Oracle 11g rac database软件
[[email protected] ~]$ cd /usr/app/product/oracle/11.2.0/deinstall/
[[email protected] deinstall]$ ./deinstall卸载Oracle 11g rac grid软件
[[email protected] ~]$ cd /usr/app/product/grid/11.2.0/deinstall/
[[email protected] deinstall]$ ./deinstall
如果在安装过程中出现问题需要重新安装grid infrastructure软件,那么还需要对ocr及votingdisk所在区域进行清理(ASM):
[[email protected] ~]# dd if=/dev/zero of=/dev/emcpowera1 bs=10M count=10
[[email protected] ~]# dd if=/dev/zero of=/dev/emcpowerb1 bs=10M count=10
[[email protected] ~]# dd if=/dev/zero of=/dev/emcpowerc1 bs=10M count=10方案二、手工卸载
今天因为需要,写了Linux的,实测了一下,效果很好,测试环境:OEL 6.5 + Oracle 11.2.0.3 RAC
手工清理rac环境,轻松还原裸系统(准备重新安装):
rm -rf /etc/oracle/
rm -f /etc/init.d/init.cssd
rm -f /etc/init.d/init.crs
rm -f /etc/init.d/init.crsd
rm -f /etc/init.d/init.evmd
rm -f /etc/rc2.d/K96init.crs
rm -f /etc/rc2.d/S96init.crs
rm -f /etc/rc3.d/K96init.crs
rm -f /etc/rc3.d/S96init.crs
rm -f /etc/rc5.d/K96init.crs
rm -f /etc/rc5.d/S96init.crs
rm -Rf /etc/oracle/scls_scr
rm -f /etc/inittab.crs
rm -f /etc/ohasd
rm -f /etc/oraInst.loc
rm -f /etc/oratab
rm -rf /tmp/.oracle
rm -rf /tmp/ora*
rm -rf /var/tmp/.oracle
rm -rf /tmp/CVU*
rm -rf /tmp/Ora*
rm -rf /home/grid/.oracle
rm -rf /usr/app/*
mv /etc/init.d/init.ohasd /etc/init.d/init.ohasd.bak
ps -ef | grep crs
ps -ef | grep evm
ps -ef | grep css
dd if=/dev/zero of=/dev/emcpowerc bs=1M count=256
dd if=/dev/zero of=/dev/emcpowerd bs=1M count=256
dd if=/dev/zero of=/dev/emcpowere bs=1M count=256
dd if=/dev/zero of=/dev/OCR_VOTE01 bs=1M count=256
dd if=/dev/zero of=/dev/OCR_VOTE02 bs=1M count=256
dd if=/dev/zero of=/dev/OCR_VOTE03 bs=1M count=256
重新创建目录
mkdir -p /usr/app/product/oraInventory
chown -R grid:oinstall /usr/app/product/oraInventory
chmod -R 775 /usr/app/product/oraInventory
mkdir -p/usr/app/product/grid/oraInventory
chown -R grid:oinstall /usr/app/product/grid/oraInventory
chmod -R 775 /usr/app/product/grid/oraInventory
mkdir -p /usr/app/product/grid/crs
mkdir -p /usr/app/product/grid/11.2.0
chown -R grid:oinstall /usr/app/product/grid/crs
chown -R grid:oinstall /usr/app/product/grid/11.2.0
chmod -R 775 /usr/app/product/grid/crs
chmod -R 775 /usr/app/product/grid/11.2.0mkdir -p /usr/app/product/oracle
chown -R oracle:oinstall /usr/app/product/oracle
chmod -R 775 /usr/app/product/oraclemkdir -p /usr/app/product/oracle/11.2.0/db_1
chown -R oracle:oinstall /usr/app/product/oracle/11.2.0/db_1chmod -R 775/usr/app/product/oracle/11.2.0/db_1