Duplicating a Database with RMAN

Posted on

Question :

I would like to duplicate to the same server Oracle Database with RMAN. I’ve configured flash recovery area for Oracle Database. My database is using SPFILE as shown below.

SQL> SELECT DECODE(value, NULL, 'PFILE', 'SPFILE') "Init File Type"
FROM sys.v_$parameter WHERE name = 'spfile

SPFILE

My questions are:

  1. if my source database uses SPFILE then do I have create a PFILE from the SPFILE? If so, how can I do that?

  2. What do they mean by this?

    You only need to create directories that are referenced in the PFILE or SPFILE.

    Which directories need to be created?

    Production Database : /u01/app/oracle/oradata/DB11G/. My SPFILE (spfileDB11g.ora):

    DB11G.__java_pool_size=4194304
    DB11G.__large_pool_size=4194304
    DB11G.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
    DB11G.__pga_aggregate_target=155189248
    DB11G.__sga_target=264241152
    DB11G.__shared_io_pool_size=0
    DB11G.__shared_pool_size=171966464
    DB11G.__streams_pool_size=4194304
    *.audit_file_dest='/u01/app/oracle/admin/DB11G/adump'
    *.audit_trail='db'
    *.compatible='11.2.0.0.0'
    *.control_files='/u01/app/oracle/oradata/DB11G/control01.ctl','/u01/app/oracle/oradata/DB11G/control02.ctl'#Restore Controlfile
    *.db_block_size=8192
    *.db_domain='localdomain'
    *.db_flashback_retention_target=720
    *.db_name='DB11G'
    *.db_recovery_file_dest='/u01/app/oracle/fra'
    *.db_recovery_file_dest_size=3221225472
    *.diagnostic_dest='/u01/app/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=DB11GXDB)'
    *.log_archive_dest_1='location=/u01/app/oracle/archive_logs'
    *.log_archive_format='db11g%r_%t_%s.arc'
    *.memory_target=417333248
    *.open_cursors=3^AC^@^@C"^@^@^D^@^@^@^@^@^@^@^@^@^A^DU^F^@^@00
    *.processes=150
    *.remote_login_passwordfile='EXCLUSIVE'
    *.undo_tablespace='UNDOTBS1'
    
  3. if backup files (autobackup and backup set) are in a different path on the source host (not default FRA Path) then how can I use the duplicate command? BTW, only the flashback logs are in the default location (/u01/app/oracle/fra/flashback). Path: /u01/app/oracle/oradata/DB11G/autobackup and /u01/app/oracle/oradata/DB11G/backupset.

Answer :

If my source database uses SPFILE then do I have create a PFILE from the SPFILE?

Yes, you need to create a temporary PFILE to use while duplicating the database. You will later switch the new instance to use the SPFILE.

Use

CREATE PFILE = 'path/to/pfile' FROM SPFILE;

You only need to create directories that are referenced in the PFILE or SPFILE.
Which directories need to be created?

You will start the database as NOMOUNT to begin the duplication. This means the controlfiles will not be read, and so you don’t need to have the directories in which the datafiles reside present in your new host. However, the directories references in the parameter files must be present. From your transcript,

DB11G.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
*.audit_file_dest='/u01/app/oracle/admin/DB11G/adump' 
*.control_files='/u01/app/oracle/oradata/DB11G/control01.ctl','/u01/app/oracle/oradata/DB11G/control02.ctl'#Restore Controlfile
*.db_recovery_file_dest='/u01/app/oracle/fra'
*.diagnostic_dest='/u01/app/oracle'
*.log_archive_dest_1='location=/u01/app/oracle/archive_logs'

You may find this chapter of the documentation useful: http://docs.oracle.com/cd/B28359_01/backup.111/b28270/rcmdupdb.htm#i1006474

3

In case of the oldskool manual duplicate
on the target server ( where you want the duplication )
you can do rman target /
catalog start with ‘<path to backup>’;

Then it’ll print out all the backups, don’t worry if you have other files in here. He’ll give a couldn’t read header something.

After this you should do crosscheck backup;
So it will be updated with what is present. It’ll show the backups it can’t reach anymore with expired. You don’t have to do delete expired.

You can can also do a duplicate from an active database which is easier.
cfr http://docs.oracle.com/cd/B28359_01/backup.111/b28270/rcmdupdb.htm#i1006629

Leave a Reply

Your email address will not be published. Required fields are marked *