Tuesday, January 31, 2017

Relocating RAC database and instances across nodes

Presuming you have an RAC database named RACNVT with an instance RACNVT1 running on raclinux1 node and you wish to relocate the instance permanently or temporally to raclinux2 node due to a prolonged maintenance scheduled on the raclunux1 node, or maybe the node resources are heavily consumed and you want to reduce the usage by relocating the instance. We are going to demonstrate here how to relocate an instance from one node to another.
The following output demonstrates where the RAC database and its instances are running:


[oracle@raclinux1 ~]$ ./crs_stat.sh
HA Resource Target                                              State
ora.RACNVT.RACNVT1.inst        ONLINE      ONLINE on raclinux1
ora.RACNVT.db                            ONLINE      ONLINE on raclinux2
ora.raclinux1.ASM1.asm                ONLINE      ONLINE on raclinux1
ora.raclinux1.LISTENER_RACLINUX1.lsnr   ONLINE   ONLINE on raclinux1
ora.raclinux1.LISTENER_RCONFIG_RACLINUX1.lsnr  ONLINE   ONLINE on raclinux1
ora.raclinux1.RACDB_RACLINUX1.lsnr   ONLINE   ONLINE on raclinux1
ora.raclinux1.gsd                            ONLINE        ONLINE on raclinux1
ora.raclinux1.ons                            ONLINE        ONLINE on raclinux1
ora.raclinux1.vip                             ONLINE       ONLINE on raclinux1
ora.raclinux2.ASM2.asm                 ONLINE       ONLINE on raclinux2
ora.raclinux2.LISTENER_RACLINUX2.lsnr    ONLINE   ONLINE on raclinux2
ora.raclinux2.RACDB_RACLINUX2.lsnr         ONLINE   ONLINE on raclinux2
ora.raclinux2.gsd                             ONLINE       ONLINE on raclinux2
ora.raclinux2.ons                             ONLINE       ONLINE on raclinux2
ora.raclinux2.vip                              ONLINE       ONLINE on raclinux2







This output confirms that the RAC database RACNVT is registered on the raclinux2 node and its instance RACNVT1 is running on the raclinux1 node, which is the expected behavior in an RAC environment. Assuming for any valid reasons you wish to relocate the instance from raclinux1 node to raclinux2 node, you will need to complete the following sequence on the raclinux2 node:

1. Prepare an spfile on raclinux2 for the RACNVT2 instance, and make any necessary changes. (We will change the instance name to match the node number.)
2. Create a password file for the RACNVT2 instance on raclinux2 node.
3. Ensure that the disk groups used for RACNVT database are mounted on raclinux2 node, via an ASM instance.
4. Create a Listener on raclinux2 node with the required port.
Relocating the instance
Once we have performed the above steps, let's move on to relocating the instance
using the examples mentioned below.
First, stop the instance on raclinux1 node using the following command:

#srvctl stop instance -d RACNVT -i RACNVT1


After the instance is stopped successfully, remove it from the raclinux1 node using the following command:

#srvctl remove instance -d RACNVT -i RACNVT1
Remove instance RACNVT1 from the database RACNVT? (y/[n]) y
If the RACNVT1 instance is not stopped properly when you attempt to remove it from
the node, the following cluster error will be shown:
PRKP-1023 : The instance {0} is still running.RACNVT


Adding the instance example
After successfully removing the instance from the node, use the following example
to add the instance on the raclinux2 node:
#srvctl add instance –d RACNVT –i RACNVT2 –n raclinux2
As we mentioned earlier, while adding the instance, you have the flexibility to
change its name according to the standards that you follow in your environment.
We changed the instance name from RACNVT1 to RACNVT2. However, ensure that
you have made the changes accordingly to your passwordfile and instance_name
parameter in the spfile to reflect the new name.
Once the instance is added successfully, bring up the instance using the following
cluster command:
#srvctl start instance -d RACNVT –I RACNVT2
Using the following cluster command, you can verify that the database/instance has
been successfully moved to raclinux2 node:
[oracle@raclinux2 ~]$ ./crs_stat.sh

HA Resource Target State
ora.RACNVT.RACNVT2.inst ONLINE ONLINE on raclinux2



For any questions on this topic, please email me on samiappsdba@gmail.com