This discussion is archived
10 Replies Latest reply: Dec 21, 2012 6:27 PM by Kavanagh RSS

Letting RMAN know about the backup piece location during RMAN DUPLICATE

Kavanagh Newbie
Currently Being Moderated
RDBMS Version: 11.2.0.3
Platform : AIX 6.1

I was going through some threads lately on Standby DB creation using RMAN DUPLICATE method.

Borrowing an example from a thread by steve74 yesterday.

The below commands are run after copying the backup pieces of Primary DB's Hot backup to standby server.
--- Will be running the following DUPLICATE command from standby server 
 
export ORACLE_SID=orcldg
SQL> startup nomount pfile='/u01/app/oracle/11.2/db_home1/dbs/initorcldg.ora'
 
 
rman target sys/mypass@PRIMARY_TNS auxiliary / 
 
run 
{
     allocate channel C1 device type disk;
     allocate auxiliary channel C2 device type disk;
     duplicate target database for standby nofilenamecheck;
}
The auxillary instance is just in NOMOUNT state. Lets say I've copied primary DB's backup pieces to the
following location in standby server
/u04/backup/RMAN
I don't see any commands above which lets RMAN know about this location where backup pieces are stored. For regular DB cloning , we do cataloging of backup pieces using CATALOG command. But , you need a control file to do the cataloging. The auxillary instance doesn't have control file yet. So, how does this work ?
  • 1. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Shivananda Rao Guru
    Currently Being Moderated
    Hello Kavanagh,

    In this case, the target database controlfile would be updated about the new location of the backup pieces. (/u04/backup/RMAN)


    Regards,
    Shivananda
  • 2. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Kavanagh Newbie
    Currently Being Moderated
    In this case, the target database controlfile would be updated about the new location of the backup pieces
    How ? How will RMAN know about the location of backup pieces in the standby server ? I didn't see any commands for this above.
  • 3. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Pinela Journeyer
    Currently Being Moderated
    hi kavanaugh,

    if you used OS commands to move the backuppieces to /u04 AND the backup was NOT created in that location, RMAN will NOT know of the location.
    you need to catalog the backuppieces in the new location.
    while connected to the primary DB, from the standby server, issue:
    RMAN>catalog start with '/u04/backup/RMAN/'
    this should work.
    but, for regular duplicates, I usually maintain the same directory path in both servers.
    although I understand, this may not always be possible.

    another solution, is that you create a symbolic link in your standby server, duplicating the existing path in your production server.

    br,
    pinela.

    Edited by: Pinela on Dec 21, 2012 7:54 AM
  • 4. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Tom Newbie
    Currently Being Moderated
    Hi Pineala,
    As OP mentioned, the control file is not restored yet. The auxillary instance is still in NOMOUNT state. You need the control file to issue the CATALOG command.

    I think (I could be wrong ) , in standby server you must use the same location in primary server when you took the RMAN hot backup.

    So, if you used /u07/data/backup in the primary DB server as the backup location, when you copy the backup pieces to standby server , you better create a location like /u07/data/backup there and store the backup pieces there. RMAN will be looking at this location by default
  • 5. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Pinela Journeyer
    Currently Being Moderated
    Hi tom,

    yes, but, when you duplicate you connect to the primary and the auxiliary.
    so you do have a CF (the primary's CF) and you can catalog into that CF.
    for example, I am sure if:
    -he moved the backup pieces into the /u04/data/backup directory in the primary server,
    - catalog them,
    -move the files into that same directory into the standby server,
    - and issued the duplicate,
    it would work.

    the other solution, is the symbolic link. I have used this technique for backups and it works (at least in 11gr2). Not sure if the duplicate will get it. But for backups it works.

    br,
    jpinela

    Edited by: Pinela on Dec 21, 2012 8:12 AM
  • 6. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Shivananda Rao Guru
    Currently Being Moderated
    How ? How will RMAN know about the location of backup pieces in the standby server ? I didn't see any commands for this above.
    My bad. Firstly, let me know why do you require to connect to the target database when you have its backup on the standby server ?

    Its a normal restore you do. Here are the steps:
    1. set the dbid on the standby server through RMAN (DBID of standby database would be the same as the primary database)
    2. startup force nomount the standby instance using a dummy pfile
    3. restore the spfile from the backup.
    4. Make necessary changes in the restored spfile required for a standby database  (archive destinations, service names, path of control files and related information). You can do this by creating a pfile for the above restored spfile. Make sure you start the standby instance back with the updated spfile.
    5. Connect the standby instance through RMAN and restore the standby controlfile using command "restore standby controlfile from <'path of the backup on the standby server'>".Hope you would have taken the backup of controlfile of primary database in a standby format.
    6. catalog the backups located at new location.
    7. set newnames if required for the standby datafiles.
    8. restore and recover the database.
    Finally start the MRP process. Refer this link http://shivanandarao.wordpress.com/2012/04/19/duplicating-primary-database-to-a-new-host-without-connecting-to-the-primary-database-in-oracle-10g11g/ for the steps though this is not for a standby database, it can give you an idea about the steps.

    Hope you got an idea.

    Regards,
    Shivananda
  • 7. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Kavanagh Newbie
    Currently Being Moderated
    Thank you Sivananda.

    Now I am wondering why does everyone use RMAN DUPLICATE as the preferred method to create a standby DB if this can be achieved using a regular RMAN restore, Recover ? What is the advantage of using RMAN DUPLICATE ?
  • 8. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Pinela Journeyer
    Currently Being Moderated
    Hello Shivananda,

    For a duplicate you must connect to the target database.

    For a normal restore, like you suggest, no, you don't need to be.

    but a normal restore is not a duplicate. a restore operation is simply part of the duplicate operation.

    br,
    jpinela.
  • 9. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Pinela Journeyer
    Currently Being Moderated
    hi,

    simple. duplicate is a quicker and simpler method because you issue just one command.
    After configuration, you issue just one command, and if the pfile/spfile is correctly configured, RMAN takes care of ALL the necessary steps, even for ASM (taking care of the switch datafile also). it restores the cf, it mounts the db, it restores, it recovers, it updates the CF with the correct names, it converts filenames if necessary, opens the DB etc.
    And, since only a single command is used, it is less prone to errors.
    And that saves you a lot of trouble.
    Simply you have some details, like the location of the backuppieces.

    it works great also for DEV env refreshes (with some modifications to the pfile/spfile).

    br,
    jpinela.

    Edited by: Pinela on Dec 21, 2012 4:02 PM
  • 10. Re: Letting RMAN know about the backup piece location during RMAN DUPLICATE
    Kavanagh Newbie
    Currently Being Moderated
    Great explanation Pinela. THANK YOU.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points