Monday, January 12, 2015

Configuring Oracle Dataguard for RAC

Before we start, first you should check my article Configuring Oracle Dataguard, for a single node primary database and single node standby database; because configuring Dataguard for RAC is not much different than setting up Dataguard for single node database. During this article, I would be referring to the aforementioned document rather than
“re-inventing the wheel” by writing all steps here. I would only explain those steps which require modification or need to be executed differently to configure Dataguard in RAC environment. This Dataguard setup guide should work for 10g, 11g and 12c

We have following 2 topologies to set up Dataguard in RAC environment
1) Primary database on RAC with standby database on single server
2) Primary database on RAC with standby database also on RAC
For this article, we will be working on 2 nodes RAC

Let’s discuss both of abovementioned topologies one by one.

Primary RAC with Single Server Standby























As we see in the above diagram, each RAC node needs to do the log shipping to a single standby 
node. We will follow same steps as mentioned in “Configuring Oracle Dataguard” document. Only difference is in Step 8, 18 and 19 where we need slight modifications. For rest of the steps, wherever “primary host” or “primary database” is mentioned, we will execute that step on either one of the RAC node/instance, but we should consistently use that node till the end.

Step 8 needs to be performed on both of the RAC nodes – moreover, the TNS entry for PRODB should contain addresses of both of the RAC nodes so that standby database can connect to both of the RAC instances. TNS entry should look like as bellow.
PRODDB=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <PRIMARY_NODE1_VIP>)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = <PRIMARY_NODE2_VIP>)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PRODDB)
    )
  )

PRODDB_STBY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <STANDBY_HOST_IP>)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PRODDB_STBY)
    )
  )

Step 18 shows the init parameters modification which is required to be performed on both nodes.
Step 19 shows how to create standby redo logs. For RAC, we need to add standby redo logs
on both nodes (instances/threads). We should make sure that standby redo logs are created at a shared location; accessible to all the RAC instances. Following is the example to create the standby logfile groups for both RAC instances (threads). Here we suppose that instance 1 has online redo log groups 1, 2, 3 and instance 2 has online redo log groups 4, 5, 6. So we will create 4 standby redo log groups for each of the instances (threads).
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1
GROUP 7 ('+DATA','+FRA') SIZE 100M,
GROUP 8 ('+DATA','+FRA') SIZE 100M,
GROUP 9 ('+DATA','+FRA') SIZE 100M,
GROUP 10 ('+DATA','+FRA') SIZE 100M;

SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2
GROUP 11 ('+DATA','+FRA') SIZE 100M,
GROUP 12 ('+DATA','+FRA') SIZE 100M,
GROUP 13 ('+DATA','+FRA') SIZE 100M,
GROUP 14 ('+DATA','+FRA') SIZE 100M;

In short, we only need to execute steps 8, 18 and 19 differently to implement a Dataguard where primary database is RAC and standby is single node database.

Primary RAC with Standby RAC
To implement this topology, we would need to execute step 8, 18 and 19 same as mentioned in above RAC to single node Dataguard topology because in this topology, we again have a RAC as primary database. Other steps/details are as follows.




















In above diagram, you can see how a 2 nodes primary and a 2 nodes standby Dataguard environment look like. Solid arrows in this diagram depict the settings if you have setup TNS entry (specified in log_archive_dest_2) in such way that each primary instance ships redo logs to its corresponding standby instance, whereas dotted arrows depicts TNs settings whereby each primary instance can ship redo logs to either of the standby instance (by having ADDRESS of both standby nodes in the TNS configured on primary) – which is also a better approach. To accomplish this, we would use following type of TNS settings for step 8 where we will have TNS entries as follows on both primary as well as standby RAC nodes.
PRODDB=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <PRIMARY_NODE1_VIP>)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = <PRIMARY_NODE2_VIP>)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PRODDB)
    )
  )

PRODDB_STBY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <STANDBY_NODE1_VIP>)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = <STANDBY_NODE2_VIP>)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PRODDB_STBY)
    )

  )
Step 12 also needs to be performed on both of standby RAC nodes so that we have correct and consistent init parameters settings.

Lastly, in step 16, we would need to add standby redo logs for both of the standby instances/threads.
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1
GROUP 15 ('+DATA','+FRA') SIZE 100M,
GROUP 16 ('+DATA','+FRA') SIZE 100M,
GROUP 17 ('+DATA','+FRA') SIZE 100M,
GROUP 18 ('+DATA','+FRA') SIZE 100M;

SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2
GROUP 19 ('+DATA','+FRA') SIZE 100M,
GROUP 20 ('+DATA','+FRA') SIZE 100M,
GROUP 21 ('+DATA','+FRA') SIZE 100M,
GROUP 22 ('+DATA','+FRA') SIZE 100M;


Please note that managed recovery in RAC standby database runs on only one node (of your choice). So following step (step 20) should be executed on only one node
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

No comments:

Post a Comment

Popular Posts - All Times