Oracle DataGuard 11g R2 Administration


Hello Everyone!

From my previous article, I have shared how to setup Oracle Dataguard 11.2 from scratch. The next thing that a DBA will do is to be familiar with the environment, to explore its functionality and to observe its behavior. With these, you will have a familiarization with Oracle Dataguard.

Let me know if you have some questions, clarifications and additional information so we can discuss them as soon as we can.

Thanks.

Let's share and make others love Oracle, too.


========================================================================

Familiarization with Oracle DataGuard 11.2

With our Data Guard configuration running in maximum performance mode, the validation tasks will involve:

1.         Switching redo log files from the primary.
2.         Verifying those log files are being shipped.
3.         Checking that the redo logs are applied to the physical standby database.




Redo log switch and transport

On the primary server, do the following steps:

[oracle@ server01 ~]$ sqlplus sys/oracle@banc01 as sysdba

SQL>alter system archive log current;

SQL>alter system switch logfile;

System altered.





SQL>select status, error from v$archive_dest where dest_id = 2;

STATUS    ERROR
--------- ---------------------------------------------------------
VALID

The output should have no error, otherwise, investigate the error and troubleshoot the problem.



Check the redo transport and redo apply

On the standby server:

[oracle@server02 ~]$ sqlplus sys/oracle@banc02 as sysdba

SQL> alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';

Session altered.

SQL> select sequence#, first_time, next_time, archived, applied from v$archived_log order by sequence#;




Starting Up and Shutting Down the Data Guard Instance

Shutting Down
           
            On the primary database:
           
            SQL> shutdown immediate;
     SQL> quit




           
On the standby database:
           
     SQL> alter database recover managed standby database cancel;
     SQL> shutdown immediate;
     SQL> quit

Starting Up

            On the primary database:
           
     SQL> startup;
     SQL> quit

           
On the standby database:
           
     SQL> startup nomount;
     SQL> alter database mount standby database;
     SQL> alter database recover managed standby database
          disconnect;
           

Switching the standby to READ-ONLY mode and back to recovery mode

           
Set the standby to read-only mode

On the primary database:
           
            SQL> alter system set log_archive_dest_state_2=DEFER;
           
            On the standby database:
           
            SQL> alter database recover managed standby database cancel;
     SQL> alter database open read only;




Set standby back to recovery mode (Original Setup)

On the standby database:

     SQL> shutdown immediate;
     SQL> startup nomount;
     SQL> alter database mount standby database;
     SQL> alter database recover managed standby database
          disconnect;

On the primary database:

     SQL> alter system set log_archive_dest_state_2=ENABLE;



Role Transitions

Performing a Switch Over

This process will convert the standby database to be the new primary database.

            On the primary database

            SQL> alter system archive log current;
           
On the standby database

            SQL> select sequence#, first_time, next_time,
          archived, applied
           from v$archived_log order by sequence#;







The last archive log must be transported and applied to the standby database. Check the alert logs of both databases.
           
     SQL> select * from v$archive_gap;


The output should return: “No Rows Selected”. If some rows will be selected, check the network traffic and connectivity (or take note of the issue and resolve)


On the primary database

            SQL> select * from v$archive_gap;
           
            Should also have no rows selected.

Still on the primary database

     SQL> alter database commit to switchover to physical
          standby with session shutdown;
     SQL> shutdown immediate;
     SQL> startup nomount;
     SQL> alter database mount standby database;
           
           
On the standby database

            SQL> alter database commit to switchover to primary;
     SQL> alter database open;

You have now converted the standby database as the new primary database. Now you will need to perform a manage recovery on the new standby database.


On the NEW STANDBY database

            SQL> alter database recover managed standby
          database disconnect;
           
Check the new set up for Data Guard functionality—log switch, log transport and log apply.

To revert to the original setup, perform another Switch Over and check for Data Guard functionality.


Performing a Fail Over

On the standby database

            SQL> alter database recover managed standby database finish;
     SQL> alter database activate standby database;

     SQL> shutdown immediate;
     SQL> startup;


Perform RMAN backup and check for consistency.


On the primary database (if still possible)


Shutdown the database and try to recover data. If completely destroyed, recreate the Data Guard setup using the surviving database instance.

Comments

Popular posts from this blog

RMAN Restoration to New Server with Different Directory and New Database Name

[Script] Tablespace Usage Alert

[Script] ASM Diskgroup Space Usage Alert