Using a Recovery Catalog to Sync Standby and Primary Databases

Follow

Read our docs The Purpose of this Article is to show how to sync a primary and standby database with a RMAN recovery catalog.  For example if the Production Backup is to be run from the Standby Database.

Problem Details

Problem Statement

Syncing a RMAN recovery catalog from a Primary or a Standby Databases with the from DB_UNIQUE_NAME all clause.

Applicable Error Code

RMAN-03002: failure of register command at 05/12/2017 12:25:40
RMAN-01005: Mounted control file type must be CURRENT to register the database
RMAN-03002: failure of resync from db_unique_name command at 05/15/2017 09:25:21
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server

Pre-requisities

The names, number and locations of the Redo Log members must be consistent across the Primary/Standby sites.Otherwise the following error can be experienced: 

RMAN-03002: failure of allocate command at 05/10/2017 03:00:20
RMAN-03014: implicit resync of recovery catalog failed
RMAN-03009: failure of partial resync command on default channel at 05/10/2017 03:00:20
RMAN-20036: invalid record order.

Relevant Metalink Note: Resync Catalog From db_unique_name All; Fails With RMAN-20036 (Doc ID 1460889.1)

Affected Platforms

Oracle 11gR2 onwards

 
Solution

Ensure the Standby database has an Unique Name as identified by the db_unique_name parameter.  

See example below:


Standby
 
SQL> select name, database_role, db_unique_name from v$database;
 
NAME DATABASE_ROLE DB_UNIQUE_NAME
--------- ---------------- ------------------------------
TESTDB PHYSICAL STANDBY TESTDB_STBY
 
Primary
 
SQL> select name, database_role, db_unique_name from v$database;
 
NAME DATABASE_ROLE DB_UNIQUE_NAME
--------- ---------------- ------------------------------
TESTDB PRIMARY TESTDB

The Standby And Primary Databases need to be registered with the listener and connect strings matching the db_unique_name values configured for the primary database and standby databases. This enables RMAN to connect remotely and perform re synchronization when the RESYNC CATALOG FROM DB_UNIQUE_NAME command is used. 


oracle@dbvlab03[/home/oracle]: rman target / catalog rman/rman@laa

Recovery Manager: Release 11.2.0.4.0 - Production on Mon May 15 09:36:52 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: TESTDB (DBID=2725042839)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN>CONFIGURE DB_UNIQUE_NAME 'TESTDB_STBY' CONNECT IDENTIFIER 'TESTDB_STBY'; RMAN> list db_unique_name of database; List of Databases DB Key DB Name DB ID Database Role Db_unique_name ------- ------- ----------------- --------------- ------------------ 1849 TESTDB 2725042839 PRIMARY TESTDB 1849 TESTDB 2725042839 STANDBY TESTDB_STBY RMAN> resync catalog from db_unique_name all; starting full resync of recovery catalog full resync complete resyncing from database with DB_UNIQUE_NAME TESTDB_STBY

The same operation can be performed from the Standby


RMAN> resync catalog from db_unique_name all;
resyncing from database with DB_UNIQUE_NAME TESTDB
starting full resync of recovery catalog
full resync complete
Have more questions? Submit a request

Comments

  • Avatar
    Dba

    Hi Petr,

    After recreation of standby controlfile, I tested "backup datafile 1" which is completed successfully.
    But it is strange that I am still getting error with "resync catalog from db_unique_name all", see below.

    RMAN> SET ENCRYPTION IDENTIFIED BY "***" ONLY;

    RMAN-03023: executing command: SET encryption

    RMAN> backup datafile 1;

    RMAN-03090: Starting backup at 19.08.2021 10:41:23
    RMAN-12016: using channel ORA_SBT_TAPE_1
    RMAN-08008: channel ORA_SBT_TAPE_1: starting full datafile backup set
    RMAN-08010: channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
    RMAN-08522: input datafile file number=00001 name=+DATA/XID/DATAFILE/system.257.1024662299
    RMAN-08038: channel ORA_SBT_TAPE_1: starting piece 1 at 19.08.2021 10:41:24
    RMAN-08044: channel ORA_SBT_TAPE_1: finished piece 1 at 19.08.2021 10:41:59
    RMAN-08530: piece handle=c906t56k_24969_1_1 tag=TAG20210819T104123 comment=API Version 2.0,MMS Version 12.2.0.2
    RMAN-08540: channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:35
    RMAN-03091: Finished backup at 19.08.2021 10:41:59

    RMAN-03090: Starting Control File and SPFILE Autobackup at 19.08.2021 10:41:59
    RMAN-08503: piece handle=c-3918042134-20210819-0d comment=API Version 2.0,MMS Version 12.2.0.2
    RMAN-03091: Finished Control File and SPFILE Autobackup at 19.08.2021 10:42:16

    RMAN> resync catalog from db_unique_name all;

    RMAN-06615: resyncing from database with DB_UNIQUE_NAME XIDSTBY2
    RMAN-08002: starting full resync of recovery catalog
    RMAN-01005: got ORA-20036: Invalid record order
    ORA-06512: at "RCAT18C_USER.DBMS_RCVCAT", line 11810 during resync
    RMAN-01005: retrying with snapshot controlfile
    RMAN-08002: starting full resync of recovery catalog
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of resync from db_unique_name command at 08/19/2021 10:43:11
    RMAN-03009: failure of resync from db_unique_name command on default channel at 08/19/2021 10:43:11
    RMAN-20036: invalid record order

    Regards,
    Miku