oracle 11g rac
1.删除实例
实例是由policy-managed或administrator-managed,删除实例的步骤是不同的。
情况一、policy-managed
执行以下命令
$ srvctl stop instance -d ORCL -n rac2
$ srvctl relocate server -n rac2 -g Free
第一条命令是停止Instance,第二条命令从当前的server pool中移除节点,迁移到空闲的server pool中。
情况二、administrator-managed
1)停止Instance
执行以下命令
$ srvctl status database -d ORCL
$ srvctl stop instance -d ORCL -n rac2
2)DBCA删除instance(rac1执行)
(oracle用户)
方式一:静默方式
执行以下命令:
[oracle@rac1 ~]$ dbca -silent -deleteInstance -nodeList rac2 -gdbName ORCL -instanceName ORCL2 -sysDBAUserName sys -sysDBAPassword oracle
命令参考:
$ dbca -silent -deleteInstance -nodeList node_name -gdbName gdb_name -instanceName instance_name -sysDBAUserName sysdba -sysDBAPassword password
参数说明:
node_name: 想要添加到的节点名
g
gdb_name: global database name
i
instance_name: 指定实例名
s
sysdba: 有sysdba权限的用户
p
password: 密码
方式二:DBCA图形界面方式 删除节点
2.删除oracle软件
1)停止并移除监听(rac1)
$ srvctl disable listener -n rac2
$ srvctl stop listener -n rac2
2)更新inventory(rac2)
$ cd $ORACLE_HOME/oui/bin
[oracle@rac2 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={rac2}" -local
3)卸载oracle软件(rac2)
$ cd $ORACLE_HOME/deinstall
$ ./deinstall -local
4)更新inventory(rac1)
$ cd $ORACLE_HOME/oui/bin
$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={rac1}"
注:rac1为保留节点名
3.删除GI软件
1)查看集群节点信息
(grid用户)
[grid@rac1 ~]$ olsnodes -s -t
rac1 Active Unpinned
rac2 Active Unpinned
上条命令显示节点是否处于active状态,以及是否处于固定(pin)状态。
如果是pinned,需要设置为unpinned
# crsctl unpin css -n rac2
2)禁止集群程序和守护进程(rac2)
(root用户)
# export ORACLE_HOME=/u01/app/11.2.0/grid
# cd $ORACLE_HOME/crs/install
# perl rootcrs.pl -deconfig -force
如果遇到以下问题
Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . .) at crsconfig_lib.pm line 703.
B
BEGIN failed--compilation aborted at crsconfig_lib.pm line 703.
C
Compilation failed in require at ./rootcrs.pl line 305.
B
BEGIN failed--compilation aborted at ./rootcrs.pl line 305.
执行以下命令得以解决
#
# cp /u01/app/11.2.0/grid/perl/lib/5.10.0/Env.pm /usr/lib64/perl5/vendor_perl/
3)删除节点信息(rac1)
# cd /u01/app/11.2.0/grid/bin
#
# ./crsctl delete node -n rac2
4)更新inventory(rac2)
(grid用户)
$ cd $ORACLE_HOME/oui/bin
$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={rac2}" CRS=TRUE -silent -local
5)卸载GI软件(rac2)
(grid用户)
$ cd $ORACLE_HOME/deinstall
$
$ ./deinstall -local
期间要根据提示运行一条长命令(root用户)
Run the following command as the root user or the administrator on node "rac2".
/tmp/deinstall2023-09-18_03-18-25PM/perl/bin/perl -I/tmp/deinstall2023-09-18_03-18-25PM/perl/lib -I/tmp/deinstall2023-09-18_03-18-25PM/crs/install /tmp/deinstall2023-09-18_03-18-25PM/crs/install/rootcrs.pl -force -deconfig -paramfile "/tmp/deinstall2023-09-18_03-18-25PM/response/deinstall_Ora11g_gridinfrahome1.rsp"
最后还要运行三条清理命令(root用户)
rm -rf /etc/oraInst.loc
rm -rf /opt/ORCLfmap
rm -rf /etc/oratab
6)再次更新inventory(rac1)
$ cd $ORACLE_HOME/oui/bin
$
$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={rac1}" CRS=TRUE -silent
7)检查节点是否删除干净(rac1)
(grid用户)
$ cluvfy stage -post nodedel -n rac2 -verbose
8)备份OCR
# cd /u01/app/11.2.0/grid/bin
# ./ocrconfig -manualbackup
4.删除节点后验证
1)验证资源状态
[root@rac1 bin]# crsctl stat res -t
2)验证数据库实例信息
SQL> select instance_number,instance_name,host_name from gv$instance;
INSTANCE_NUMBER INSTANCE_NAME HOST_NAME
--------------- ---------------- -----------------
1 ORCL1 rac1