ORACLE 11G :ACTIVE DATABASE DUPLICATION

Oracle 11g introduced active database duplication using which we can create a duplicate database of the target database without any backups. Duplication is performed over the network.
Procedure :
Overview:
on the source  host
- Create Pfile from source database
- Create an entry in tnsnames.ora for duplictae database on target host on port 1522
on the target host
- Add a line in the file /etc/oratab to reflect the database instance you are going to copy
- create folders
- Copy the initialization parameter file from the source database add edit it.
- Copy the password file
- Create a listener in database home on port 1522 and register duplicate database statically with it
- Startup the target database in nomount mode using modified parameter file
- Using RMAN  connect to the source database(orcl) as target database and duplicate database (orclt) as auxiliary instance
- duplicate the target database
********************************
  source database  orcl
  Duplicate database  orclt
***********************************
Implementation
– On source host
– CREATE PFILE FROM SOURCE DATABASE
SQL>CREATE PFILE=’/u01/app/oracle/oradata/orcl/initsource.ora’     FROM SPFILE;
– On source database, create a service for orclt on target host on port 1522
The rest of the steps occur on the target host.
– Add a line in the file /etc/oratab to reflect the database instance you are going to copy
     orclt:/u01/app/oracle/product/11.2.0/db1:N
– Now set the Oracle SID as the duplicated database SID:
# . oraenv
ORACLE_SID = [orclt] ?
– create folders
 $mkdir -p /u01/app/oracle/oradata/orclt
  mkdir -p /u01/app/oracle/flash_recovery_area/orclt
  mkdir -p /u01/app/oracle/admin/orclt/adump
  mkdir -p /u01/app/oracle/admin/orclt/dpdump
– Copy the initialization parameter file from the main database.
$cp  /u01/app/oracle/oradata/orcl/initsource.ora /u01/app/oracle/oradata/orclt/inittarget.ora
– Edit the initialization parameter file
$vi /u01/app/oracle/oradata/orclt/inittarget.ora
   – Change db_name = orclt
   – Edit it to reflect the new locations that might be appropriate
     such as control file locations,audit dump destinations, datafile
     locations, etc.
   – add these lines –
     db_file_name_convert = (“/u01/app/oracle/oradata/orcl”,
                             “/u01/app/oracle/oradata/orclt”)
     log_file_name_convert = (“/u01/app/oracle/oradata/orcl”,
                             “/u01/app/oracle/oradata/orclt”)
In case source and destination databases ae ASM, following lines can be added :
db_file_name_convert = (“+DATA/orcl”,”+DATA/orclt”)
log_file_name_convert = (“+DATA/orcl”,”+DATA/orclt”, “+FRA/orcl”,”+FRA/orclt”)
– Copy the password file as well
$cp /u01/app/oracle/product/11.2.0/db_1/dbs/orapworcl  /u01/app/oracle/product/11.2.0/db_1/dbs/orapworclt
 
– Startup the target database in nomount mode using modified parameter file
$ . oraenv
ORACLE_SID = [orclt] ?
$sqlplus sys/oracle as sysdba
SQL> startup nomount pfile=’/u01/app/oracle/oradata/orclt/inittarget.ora';
     create spfile from pfile=’/u01/app/oracle/oradata/orclt/inittarget.ora';
– create a listener on port 1522 in database home on target host and statically register service
    orclt with it.
 
– connect to the auxiliary instance
$. oraenv
   orclt
$rman target sys/oracle@orcl auxiliary sys/oracle@orclt
– duplicate the database orcl to orclt from active database
– the command performs the following steps:
    * Creates an SPFILE
    * Shuts down the instance and restarts it with the new spfile
    * Creates the controlfile for standby database
    * Mounts the database
    * Performs restore of the datafiles. In this stage it creates the files in the
      converted names.
    * Recovers the datafiles up to the time specified and opens the database
RMAN>duplicate target database to orclt from active database;
– check that duplicate database is up
$sqlplus / as sysdba
sql>conn hr/hr
    select * from tab;
-- Note that  DBID is different from the main database so it can be backed up
   independently and using the same catalog as well.
SQL> select dbid from v$database;
      DBID
———-
3779357884
     conn sys/oracle@orcl as sysdba
    
     select dbid from v$database;
      DBID
———-
1326904854
———————————————————————————————–
Related links:
                                                                                             ————————

7 thoughts on “ORACLE 11G :ACTIVE DATABASE DUPLICATION

  1. Hi Ritu,

    I have been reading your valuable articles from a long time, thanks for sharing knowledge.

    I have a question regarding active database duplication as you mentioned (3rd line Restores the controlfile from the backup)

    – duplicate the database orcl to orclt from active database
    – the command performs the following steps:
    * Creates an SPFILE
    * Shuts down the instance and restarts it with the new spfile
    * Restores the controlfile from the backup

    It means rman restoring controlfile from available backup of source database (orcl) rather than directly restoring from existing controlfile at source ????

    If we are restoring it from available backup then how it is different than backup based duplication.

    Regards,
    Varun

    1. Hi Varun,

      First of all, I think you have misread my name. My name is Anju Garg.
      As far as your question about active duplication, thanks for pointing out the typo. In fact, the command does not restore controlfile from backup. Rather it creates controlfile for standby by connecting to primary over network.
      I have corrected it.

      Thanks and regards
      Anju Garg

  2. Hi Madam,

    I have one doubt,

    1. what is the difference between RMAN cold backup and normal cold backup (OS copy) ?

    (they both need the database down time)
    2. What are the advantages of RMAN cold backup compare to normal cold backup?

    1. Hi Damodhar,

      Although both RMAN cold backup and normal cold backup need database down time, backup taken using RMAN has an entry in RMAN catalog and hence can be restored using RMAN.
      OS copy does not have any entry in RMAN catalog. Hence to restore OS copy
      1. Restore manually or
      2. Add it to RMAN catalog so that it can be restored using RMAN.

      regards
      Anju Garg

      1. Thank You Madam,

        is it possible to recover the database using archivelogs on the top of the RMAN cold backup?
        i mean is it possible to apply the archive logs on top of RMAN cold backup?

Leave a Reply to Anju Garg Cancel reply