Views expressed here are solely that of my own. Please make sure that you test the code/queries that appear on my blog before applying them to the production environment.

Sunday, June 19, 2011

How to delete and then add the same Oracle RAC node to an Oracle 10gR2 cluster

If you will need this kind of operation any time, you can use the following steps to remove and then add the same Oracle RAC node to an Oracle 10gR2 Cluster.

1-) Remove node2 from cluster :

First we backed up the OCR configuration (in case we need it)
[root@srvdb01]:/home/root > ocrconfig -export beforeupgrade -s online

Then we got RAC network configuration on first node.
[root@srvdb01]:/home/root > oifcfg getif
en8  10.1.11.0  global  public
en9  192.168.1.0  global  cluster_interconnect

List nodeapps
[root@srvdb01]:/home/root > crsstat
HA Resource                                   Target     State
-----------                                   ------     -----
ora.ORCL.ORCL1.inst                           ONLINE     ONLINE on srvdb01
ora.ORCL.db                                   ONLINE     ONLINE on srvdb01
ora.srvdb01.ASM1.asm                          ONLINE     ONLINE on srvdb01
ora.srvdb01.LISTENER_SRVDB01.lsnr             ONLINE     ONLINE on srvdb01
ora.srvdb01.gsd                               ONLINE     ONLINE on srvdb01
ora.srvdb01.ons                               ONLINE     ONLINE on srvdb01
ora.srvdb01.vip                               ONLINE     ONLINE on srvdb01
ora.ORCL.ORCL2.inst                           ONLINE     ONLINE on srvdb02
ora.srvdb02.ASM2.asm                          ONLINE     ONLINE on srvdb02
ora.srvdb02.LISTENER_SRVDB02.lsnr             ONLINE     ONLINE on srvdb02
ora.srvdb02.gsd                               ONLINE     ONLINE on srvdb02
ora.srvdb02.ons                               ONLINE     ONLINE on srvdb02
ora.srvdb02.vip                               ONLINE     ONLINE on srvdb02

On node1 we removed the instance ORCL2 running on node2 by using $ORACLE_HOME/bin/dbca.
[oracle@srvdb01]:/oracle > $ORACLE_HOME/bin/dbca
Choose RAC database
Choose Instance Management
Choose Delete Instance

On node1 we stopped and removed the ASM2 instance running on node2.
[root@srvdb01]:/home/root > srvctl stop asm -n srvdb02
[root@srvdb01]:/home/root > srvctl remove asm -n srvdb02

On node2 we removed the instance LISTENER_SRVDB02 running on node2 by using $ORACLE_HOME/bin/netca.
[oracle@srvdb02]:/oracle > $ORACLE_HOME/bin/netca
Choose Cluster management
Choose Listener
Choose Remove
Confirm deletion of LISTENER_SRVDB02

On node2 update node list in $ORACLE_HOME
[oracle@srvdb02]:/oracle > $ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME CLUSTER_NODES="srvdb02" -local

On node1 update node list in $ORACLE_HOME
[oracle@srvdb01]:/oracle > $ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME CLUSTER_NODES="srvdb01"

Remove node2 from cluster
[oracle@srvdb01]:/oracle > $CRS_HOME/bin/racgons remove_config srvdb02:6201
( Replace port 6201 in the above command with the number that you see in the remote port section of the ons.config file in the CRS_HOME/opmn/conf diretory )

On node2
[root@srvdb02]:/home/root > $CRS_HOME/install/rootdelete.sh

List cluster nodes.
[root@srvdb01]:/home/root > olsnodes -n
srvdb01       1
srvdb02       2

On node1
[root@srvdb01]:/home/root > $CRS_HOME/install/rootdeletenode.sh srvdb02,2

On node2 update node list in $CRS_HOME
[oracle@srvdb02]:/oracle > $CRS_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$CRS_HOME CLUSTER_NODES="srvdb02" CRS=TRUE -local

On node1 update node list in $CRS_HOME
[oracle@srvdb01]:/oracle > $CRS_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$CRS_HOME CLUSTER_NODES="srvdb01" CRS=TRUE

Check the nodeapps have been removed on node2
[root@srvdb01]:/home/root > srvctl status nodeapps -n srvdb02

List cluster nodes.
[root@srvdb01]:/home/root > olsnodes -n
srvdb01       1

2-) Add node2 back to cluster :

Add Cluster Home
[oracle@srvdb01]:/oracle > $CRS_HOME/oui/bin/addNode.sh -nocopy

Add node2 to cluster
[oracle@srvdb01]:/oracle > $CRS_HOME/bin/racgons add_config srvdb02:6201
( Replace port 6201 in the above command with the number that you see in the remote port section of the ons.config file in the CRS_HOME/opmn/conf diretory )

Add Oracle Home
[oracle@srvdb01]:/oracle > $ORACLE_HOME/oui/bin/addNode.sh -nocopy

Configure VIP of node2
[oracle@srvdb01]:/oracle > $ORACLE_HOME/bin/vipca -nodelist srvdb02

On node2 we added the instance LISTENER_SRVDB02 running on node2 by using $ORACLE_HOME/bin/netca.
[oracle@srvdb02]:/oracle > $ORACLE_HOME/bin/netca
Choose Cluster management
Choose Listener
Choose Add
Choose the name as LISTENER
This will add a listener on node2 with the name LISTENER_SRVDB02

On node1 we added the instance ORCL2 running on node2 by using $ORACLE_HOME/bin/dbca with this step we also created the ASM2 instance.
[oracle@srvdb01]:/oracle > $ORACLE_HOME/bin/dbca
Choose RAC
Choose Instance Management
Choose Add Instance

List cluster nodes.
[root@srvdb01]:/home/root > olsnodes -n
srvdb01       1
srvdb02       2

List nodeapps
[root@srvdb01]:/home/root > crsstat
HA Resource                                   Target     State
-----------                                   ------     -----
ora.ORCL.ORCL1.inst                           ONLINE     ONLINE on srvdb01
ora.ORCL.db                                   ONLINE     ONLINE on srvdb01
ora.srvdb01.ASM1.asm                          ONLINE     ONLINE on srvdb01
ora.srvdb01.LISTENER_SRVDB01.lsnr             ONLINE     ONLINE on srvdb01
ora.srvdb01.gsd                               ONLINE     ONLINE on srvdb01
ora.srvdb01.ons                               ONLINE     ONLINE on srvdb01
ora.srvdb01.vip                               ONLINE     ONLINE on srvdb01
ora.ORCL.ORCL2.inst                           ONLINE     ONLINE on srvdb02
ora.srvdb02.ASM2.asm                          ONLINE     ONLINE on srvdb02
ora.srvdb02.LISTENER_SRVDB02.lsnr             ONLINE     ONLINE on srvdb02
ora.srvdb02.gsd                               ONLINE     ONLINE on srvdb02
ora.srvdb02.ons                               ONLINE     ONLINE on srvdb02
ora.srvdb02.vip                               ONLINE     ONLINE on srvdb02

No comments: