• Arun Kumar

RMAN in Dataguard Configuration

RMAN in data guard configuration works very normal like single standalone database. But, there are few important things you should know in order to define your backup and recovery strategy when using data guard.

  1. Need not register standby with catalog, RMAN will identify it as standby

  2. Catalog is must à This helps primary to be aware of standby backups

  3. Backup controlfile on primary à On standby the controlfile is a standby controlfile. In case of primary crash, you cannot use standby controlfile. So, at least backup controlfile and spfile on primary.

CONFIGURE CONTROLFILE AUTOBACKUP ON

4. Set proper retention policy à This will not delete backups for the specified recovery window

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

5. You can backup archive logs on both primary and standby. This will provide you archive logs redundancy but not recommended


Register Primary Database


Let us register primary database with catalog

On primary:
===========
rman target / catalog rman_rc/rman_rc@rcat
RMAN> register database;

List db_unique_name on both primary and standby via below command

On primary:
===========
RMAN>LIST DB_UNIQUE_NAME OF DATABASE;

On standby:
===========
rman target / catalog rman_rc/rman_rc@rcat
RMAN>LIST DB_UNIQUE_NAME OF DATABASE;

Define connection string for the primary and standby

rman target sys/sys@proddb catalog rman_rc/rman_rc@rcat
RMAN>configure db_unique_nameproddb connect identifier 'proddb';
RMAN>configure db_unique_nameproddb_st connect identifier 'proddb_st';

Resync catalog

RMAN>resync catalog from db_unique_name all;

See how LIST and REPORT command can help you get output from primary and standby

RMAN>list backupset for DB_UNIQUE_NAME proddb;
RMAN>list backupset for DB_UNIQUE_NAME proddb_st;
RMAN>report schema for DB_UNIQUE_NAME proddb;
RMAN>report schema for DB_UNIQUE_NAME proddb_st;

RMAN Assignment


Test Archivelog Deletion Policy


While we configured physical standby, we had already set archive deletion policy to not delete any archive until they are applied on standby.

rman target sys/sys@proddb catalog rman_rc/rman_rc@rcat
configure archivelog deletion policy to shipped to all standby;

Stop MRP on standby

On standby:
===========
SQL> alter database recover managed standby database cancel;

Generate more archives on primary, run below command few times

On primary:
===========
SQL> alter system switch logfile;

Now, try deletion archives via RMAN. Observer the error message

rman target sys/sys@proddb catalog rman_rc/rman_rc@rcat
resync catalog from db_unique_name all ;
delete archivelog all;

Enable MRP on physical standby, run archive deletion again and this time it should work fine

On standby:
===========
SQL> alter database recover managed standby database disconnect;

rman target sys/sys@proddb catalog rman_rc/rman_rc@rcat
resync catalog from db_unique_name all ;
delete archivelog all;


Recovery Datafile From Standby


You can use standby database to restore lost data files. Let us simulate an error with users tablespace.

On primary:
===========
sqlplus / as sysdba
select name from v$datafile;
alter database datafile '+DATA/proddb/datafile/example.266.941366921' offline;

Delete above datafile from asm file system as grid user

On primary:
===========
su - grid
asmcmd
ASMCMD> cd data/proddb/datafile
ASMCMD>cpexample.266.941366921example.266.941366921.orig
ASMCMD>rmexample.266.941366921
ASMCMD> exit

Restore the datafile from standby. The restored file will take a different name

On primary:
===========
rman target sys/sys@proddb catalog rman_rc/rman_rc@rcat
RMAN> restore datafile '+DATA/proddb/datafile/example.266.941366921' from service proddb_st;

Get the new file name for the restored datafile and recover it

recover datafile '<new_file_name>';

Take the datafile online on primary

SQL> alter database datafile ‘<new_file_name>’ online;



Recent Posts

See All

MySQL Installation on Linux

This article demonstrates MySQL installation on Oracle Enterprise Linux 6.5 version. Installation of MySQL Make sure you are able to connect internet via virtual machine. Try to ping google.com and pr

Add ISO image storage repository on XenServer

If you have used VMware ESXI, its very easy to upload ISO files to the data store and create VMs. With XenServer, you must create your own ISO repository to upload ISO files. Create ISO directory Acce

Oracle Data Guard Protection Modes

A Data Guard configuration always runs in one of three data protection modes (also called as redo transport rules): Maximum Protection Maximum Availability Maximum Performance (default mode of operati

  • Facebook
  • Twitter
  • YouTube
  • Instagram

© 2020 by DBA Genesis

Feedback