Translate

Wednesday, 11 April 2012

How to setup 11g active dataguard

Main advantage of 11g dataguard is

■Ability to open the standby database in read-only mode while the database is still in managed recovery mode. This means 11g active dataguard database is bi-functional, provides disaster recovery and at the same time can be used for reporting purpose.

■Able to open standby database in read-write. This is very useful to turn our standby database into application testing / development purposes. This is achieved through snapshot standby database.

Steps

Setting up active dataguard is very easy and straight forward. Initial steps to create active dataguard are as same as setting up 10g dataguard. The steps are almost similar with only few different commands. In this scenario, I have named my Niti_Production database as ‘Niti_Prod’ and standby database as ‘Niti_Stdby’ :

1. First of all, parameter file (with appropriate dataguard parameters) and standby control file must be created from the Niti_Production database.

2.Setup listener.ora and tnsnames.ora for connectivity between Niti_Production and standby.

3. Connect to rman

rman target sys/oracle@Niti_Prod auxiliary sys/oracle@Niti_Stdby

4. With 11g active dataguard, 1 simple command will create standby without even backing up Niti_Prod database and placing it in a staging area.

RMAN>duplicate target database for standby from active database;

5. Standby database successfully created with the db is in mount state.

Active Dataguard

1. Use dataguard broker to enable active dataguard.

2. If you try to open database during this time, you will get error .

3. In order to open the standby database, connect to dgmrl and change the apply state.

4. Open the standby database now.



5. Re-enable the apply state so that redo transferred and applied to standby database while the database is open for querying.

6. To disable the active dataguard, the steps are the same :

I. DGMGRL> edit database Niti_Stdby set state=apply-off;

II. Shutdown the Niti_Stdby database

III. Startup mount the Niti_Stdby database

IV. DGMGRL> edit database Niti_Stdby set state=apply-on;

Snapshot standby database

1. In order to create snapshot standby database :

■standby database must be a physical standby database
■Flashback logging must be enabled on both Niti_Production and standby database.

2. After enabling flashback mode, connect to dgmrl utility in the primary database :



3. Convert the physical standby to snapshot standby with a single command .

4. From now on, we can do any testing (like creating new schemas, tables and so on) on our standby database. Please note that at this point of time, all the redo generated in our Niti_Production database will be still shipped to standby database. But it is just that not going to be applied until the database is converted into physical standby mode.

5. Once the testing done, you can convert the snapshot standby database to physical standby with just 1 command.

DGMGRL>convert database Niti_Stdby to physical standby;

6. Note that when the above command executed

■All the changed made to the snapshot standby database ( such as creating new schemas, tables) has been terminated
■Previous physical standby database state is initiated
■Physical standby database is mounted and MRP process is initiated. MRP will apply all the logs which was shipped yet applied during the snapshot standby database state.

7. Duration for this process is depends on few factors :

■The amount of changes made to the database during the snapshot standby database state. More changes will lead to more time to rewind the changes via flashback database option.
■The amount of archived logs generated during the snapshot standby database state. More archive logs will cause more time to apply it when the database is converted to physical standby database.

No comments:

Post a Comment