DBA Tips Archive for Oracle

  


Creating a Standby Database using RMAN - (UNIX / Linux)

by Jeff Hunter, Sr. Database Administrator


Contents

  1. Overview
  2. Pre-requisites
  3. Steps Required



Overview

This article provides a quick introduction on how to create an Oracle standby database using the RMAN DUPLICATE TARGET DATABASE FOR STANDBY command on the UNIX / Linux operating environment. For this demonstration, we will create a standby database using RMAN's DUPLICATE command to a different host other than the primary database. Both hosts are running Red Hat Linux - Fedora Core 2.

Please keep in mind that this article should not be considered a substitution for completing reading and understanding the official documentation and release notes from Oracle. The following links can be used to download the Recovery Manager User's Guide for Oracle9i (9.2.0):

  Oracle9i Database Release 2 Documentation
  Oracle9i Recovery Manager User's Guide - (A96566-01)

You can use the Recovery Manager DUPLICATE TARGET DATABASE FOR STANDBY command to create a standby database. RMAN automates the following steps of the creation procedure:

  1. Restores the standby control file.
  2. Restores the primary datafile backups and copies.
  3. Optionally, RMAN recovers the standby database (after the control file has been mounted) up to the specified time or to the latest archived redo log generated.
  4. RMAN leaves the database mounted so that the user can activate it, place it in manual or managed recovery mode, or open it in read-only mode.

RMAN cannot fully automate creation of the standby database because you must manually create an initialization parameter file for the standby database, start the standby instance without mounting the control file, and perform any Oracle Net setup required before performing the creation of the standby. Also, you must have RMAN backups of all datafiles available as well as a control file backup that is usable as a standby control file. All of these steps will be fully described in this article.

After the standby database is created, RMAN can back up the standby database and archived redo logs as part of your backup strategy. These standby backups are fully interchangeable with primary backups. In other words, you can restore a backup of a standby datafile to the primary database, and you can restore a backup of a primary datafile to the standby database.

Here is a short introduction to some of the configuration parameters (and Oracle initialization parameters) that will be used for installing the Oracle RDBMS Software on both Linux servers:

Primary (Target) Database Server
Operating Environment Red Hat Linux - Fedora Core 2
Server Name linux3.idevelopment.info
Oracle Release / Version 9.2.0.5.0 Enterprise Edition
ORACLE_BASE /u01/app/oracle
ORACLE_HOME /u01/app/oracle/product/9.2.0
Database SID ORA920
Target TNS Names Entry ORA920_LINUX3.IDEVELOPMENT.INFO
Standby TNS Names Entry ORA920_LINUX4.IDEVELOPMENT.INFO
Archive Log Mode Enabled
  Initialization Parameters
archive_lag_target 0
compatible 9.2.0.5.0
control_file_record_keep_time 7
db_name ORA920
fal_client ORA920_LINUX3
fal_server ORA920_LINUX4
instance_name ORA920
local_listener ''
log_archive_dest_1 'location=/u06/app/oradata/ORA920/archive mandatory'
log_archive_dest_2 'service=ORA920_LINUX4 optional reopen=15'
log_archive_dest_state_1 enable
log_archive_dest_state_2 enable
log_archive_format arch_t%t_s%s.dbf
log_archive_start true
remote_archive_enable true
remote_login_passwordfile exclusive
service_names ORA920.IDEVELOPMENT.INFO
standby_archive_dest /u06/app/oradata/ORA920/archive
standby_file_management auto
  RMAN Configuration
Catalog Database No recovery catalog. Using control file.
Default Configuration Settings RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/orabackup/rman/ORA920/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/orabackup/rman/ORA920/backup_db_%d_S_%s_P_%p_T_%t';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/9.2.0/dbs/snapcf_ORA920.f'; # default
Standby (Auxiliary) Database Server
Operating Environment Red Hat Linux - Fedora Core 2
Server Name linux4.idevelopment.info
Oracle Release / Version 9.2.0.5.0 Enterprise Edition
ORACLE_BASE /u01/app/oracle
ORACLE_HOME /u01/app/oracle/product/9.2.0
Database SID ORA920
Target TNS Names Entry ORA920_LINUX3.IDEVELOPMENT.INFO
Standby TNS Names Entry ORA920_LINUX4.IDEVELOPMENT.INFO
Archive Log Mode Enabled
  Initialization Parameters
archive_lag_target 0
compatible 9.2.0.5.0
control_file_record_keep_time 7
db_name ORA920
fal_client ORA920_LINUX4
fal_server ORA920_LINUX3
instance_name ORA920
local_listener ''
log_archive_dest_1 'location=/u06/app/oradata/ORA920/archive mandatory'
log_archive_dest_2 'service=ORA920_LINUX3 optional reopen=15'
log_archive_dest_state_1 enable
log_archive_dest_state_2 defer
log_archive_format arch_t%t_s%s.dbf
log_archive_start true
remote_archive_enable true
remote_login_passwordfile exclusive
service_names ORA920.IDEVELOPMENT.INFO
standby_archive_dest /u06/app/oradata/ORA920/archive
standby_file_management auto
  RMAN Configuration
Catalog Database No recovery catalog. Using control file.
Default Configuration Settings N/A



Pre-requisites

Target database must be mounted or open
$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.5.0 - Production on Mon Jan 3 19:42:02 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to an idle instance.

SQL> startup open
ORACLE instance started.

Total System Global Area  252777660 bytes
Fixed Size                   451772 bytes
Variable Size             218103808 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> exit
A valid full database backup of the target database
From the target (primary) database, you will need to create a full backup of the database.
RMAN> backup database plus archivelog delete input;

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Tag
------- -- -- - ----------- --------------- ------- ------- ---
49      B  F  A DISK        04-JAN-05       1       1       TAG20050104T160515
50      B  A  A DISK        04-JAN-05       1       1       TAG20050104T160821
51      B  F  A DISK        04-JAN-05       1       1



Steps Required

  1. Create Password File for Standby Database

    Login to the standby database server and create a password file:

    $ orapwd file=/u01/app/oracle/product/9.2.0/dbs/orapwORA920 password=change_on_install


  2. Create a Standby Controlfile

    There are several ways in which to create a standby control file to be used with the standby database instance. In most cases, the easiest way is to perform this is within RMAN. Keep in mind that RMAN will need to have a copy of the standby control file within the catalog before RMAN can use it with the duplicate ... for standby command. From the target (primary) database server, use the following:

    $ ORACLE_SID=ORA920; export ORACLE_SID
    
    $ rman target /
    
    RMAN> backup current controlfile for standby format='/orabackup/rman/ORA920/stby_cfile.%U';
    
    Starting backup at 04-JAN-05
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting full datafile backupset
    channel ORA_DISK_1: specifying datafile(s) in backupset
    including standby controlfile in backupset
    channel ORA_DISK_1: starting piece 1 at 04-JAN-05
    channel ORA_DISK_1: finished piece 1 at 04-JAN-05
    piece handle=/orabackup/rman/ORA920/stby_cfile.1lg9c9e0_1_1 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
    Finished backup at 04-JAN-05
    
    Starting Control File and SPFILE Autobackup at 04-JAN-05
    piece handle=/orabackup/rman/ORA920/c-2542332757-20050104-0a comment=NONE
    Finished Control File and SPFILE Autobackup at 04-JAN-05


  3. Record Last Log Sequence

    You will need to specify a point in time after the creation of the standby control file. To do this, perform a few log switches and then record the last log sequence number from the v$archived_log view. From the target (primary) database instance:

    $ sqlplus "/ as sysdba"
    
    SQL> alter system switch logfile;
    SQL> alter system switch logfile;
    SQL> select max(sequence#) from v$archived_log;
    
    MAX(SEQUENCE#)
    --------------
               208


  4. Backup New Archive Log Files

    After creating the standby control file, you will need to backup the newly created archive redo logs (created from the alter system switch logfile; command above):

    $ rman target /
    
    RMAN> backup archivelog all delete input;
    
    Starting backup at 04-JAN-05
    current log archived
    using target database controlfile instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=12 devtype=DISK
    channel ORA_DISK_1: starting archive log backupset
    channel ORA_DISK_1: specifying archive log(s) in backup set
    input archive log thread=1 sequence=207 recid=300 stamp=546711084
    input archive log thread=1 sequence=208 recid=301 stamp=546711085
    input archive log thread=1 sequence=209 recid=302 stamp=546711172
    channel ORA_DISK_1: starting piece 1 at 04-JAN-05
    channel ORA_DISK_1: finished piece 1 at 04-JAN-05
    piece handle=/orabackup/rman/ORA920/backup_db_ORA920_S_55_P_1_T_546711173 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
    channel ORA_DISK_1: deleting archive log(s)
    archive log filename=/u06/app/oradata/ORA920/archive/arch_t1_s207.dbf recid=300 stamp=546711084
    archive log filename=/u06/app/oradata/ORA920/archive/arch_t1_s208.dbf recid=301 stamp=546711085
    archive log filename=/u06/app/oradata/ORA920/archive/arch_t1_s209.dbf recid=302 stamp=546711172
    Finished backup at 04-JAN-05
    
    Starting Control File and SPFILE Autobackup at 04-JAN-05
    piece handle=/orabackup/rman/ORA920/c-2542332757-20050104-0b comment=NONE
    Finished Control File and SPFILE Autobackup at 04-JAN-05


  5. Make the RMAN Backups Available to Standby Server

    During restore, RMAN will expect the backup sets to be located in the same directory as written to during the backup. There are several ways to accomplish this. The brute force method is to simply copy all RMAN backup sets to the standby server. You will need to ensure that the directory structure is the same on the standby database server. For example, if your RMAN backup sets on the primary database server are located in /orabackup/rman/ORA920, then they will have to be made available to the same directory, /orabackup/rman/ORA920 on the standby database server.

    For this example I want to simply create an NFS mount from the target (primary) database server to the standby (auxiliary) database server. Keep in mind that you will need root access to both machines to perform this.


    From the target (primary) database server as root, edit the file /etc/exports and add the following for the machine you want to be able to mount:

    /etc/exports
    /orabackup/rman/ORA920  linux4(rw,no_root_squash)

    After making changes to the /etc/exports file, you will need to start (or restart) the NFS daemon on the primary database server:

    # /etc/init.d/nfs restart
    Shutting down NFS mountd: [  OK  ]
    Shutting down NFS daemon: [  OK  ]
    Shutting down NFS quotas: [  OK  ]
    Shutting down NFS services:  [  OK  ]
    Starting NFS services:  [  OK  ]
    Starting NFS quotas: [  OK  ]
    Starting NFS daemon: [  OK  ]
    Starting NFS mountd: [  OK  ]


    From the standby (auxiliary) database server as the root user:

    # mkdir -p /orabackup/rman/ORA920
    
    # /etc/init.d/nfs start
    Starting NFS services:  [  OK  ]
    Starting NFS quotas: [  OK  ]
    Starting NFS daemon: [  OK  ]
    Starting NFS mountd: [  OK  ]
    
    # mount -t nfs linux3:/orabackup/rman/ORA920 /orabackup/rman/ORA920
    
    # ls -l /orabackup/rman/ORA920
    total 911920
    -rw-r-----  1 oracle dba 908828672 Jan  4 10:24 backup_db_ORA920_S_30_P_1_T_546690090
    -rw-r-----  1 oracle dba    219136 Jan  4 10:24 backup_db_ORA920_S_31_P_1_T_546690276
    -rw-r-----  1 oracle dba   7946240 Jan  4 10:24 c-2542332757-20050104-01
    -rw-r-----  1 oracle dba   7946240 Jan  4 12:54 c-2542332757-20050104-05
    -rw-r-----  1 oracle dba   7929856 Jan  4 12:54 stby_cfile.17g9bu0q_1_1


  6. Create Directory Structure on Standby (Auxiliary) Server

    On the standby database server, create all needed directories for the standby database:

    $ mkdir /u01/app/oracle/admin/ORA920
    $ mkdir /u01/app/oracle/admin/ORA920/adump
    $ mkdir /u01/app/oracle/admin/ORA920/bdump
    $ mkdir /u01/app/oracle/admin/ORA920/cdump
    $ mkdir /u01/app/oracle/admin/ORA920/create
    $ mkdir /u01/app/oracle/admin/ORA920/pfile
    $ mkdir /u01/app/oracle/admin/ORA920/scripts
    $ mkdir /u01/app/oracle/admin/ORA920/udump
    
    $ mkdir /u03/app/oradata/ORA920
    $ mkdir /u04/app/oradata/ORA920
    $ mkdir /u05/app/oradata/ORA920
    $ mkdir /u06/app/oradata/ORA920
    $ mkdir /u06/app/oradata/ORA920/archive


  7. Create an Initialization Parameter for the Standby Database

    Now, copy a version of the text initialization parameter from the target database to the standby database server and make the necessary changes for the standby database:

    From the target (primary) database server:

    $ export ORACLE_SID=ORA920
    $ sqlplus "/ as sysdba"
    
    SQL> create pfile='/u01/app/oracle/product/9.2.0/dbs/initORA920.ora' from spfile;
    
    File created.
    After creating and copying the initialization parameter for the standby database, change at least the following parameters for the standby database:
    fal_client                  = 'ORA920_LINUX4'
    fal_server                  = 'ORA920_LINUX3'
    log_archive_dest_2          = 'service=ORA920_LINUX3 optional reopen=15'
    log_archive_dest_state_2    = 'defer'

    NOTE: Keep in mind that the db_name initialization parameter of the standby database must match the db_name parameter for the primary database. This is required wether the standby database is on the same or different host from the primary database.

    If you are going to host the standby database on the same host as the primary database, you will need to make several modifications given the fact that Oracle uses the db_name to lock memory segments at the O/S level. If you were to attempt to start two databases on the same host with the same db_name parameter, you will get the following error:

    ORA-01102: Cannot mount database in exclusive mode
    To get around this, you will need to modify the init.ora file of the standby database and add the parameter lock_name_space. You would set this parameter to a value different from the db_name parameter. Oracle will then use this name to lock memory segments without changing the db_name. For example,
    lock_name_space='ORA920STBY'
    Because the db_name must be the same, the DUPLICATE command does not use the format duplicate target database to <aux_name>.. This format was necessary to reset the database name in the new control file during duplication, but during standby creation, we will not be creating a new control file. In this case, the command will look like the following:
    duplicate target database for standby;


  8. Start the Standby (Auxiliary) Instance

    On the standby database server, start the Oracle instance in nomount mode:

    $ ORACLE_SID=ORA920; export ORACLE_SID
    
    $ sqlplus "/ as sysdba"
    
    SQL> startup nomount


  9. Ensure Oracle Net Connectivity to Standby (Auxiliary) Database

    Modify both the listener.ora and tnsnames.ora file to be able to connect to the standby (auxiliary) database.

    You should first put the following two entries in the tnsnames.ora file for both the the primary (target) host and the standby (auxiliary) host:

    TNS Names Entries on the Primary and Standby Host

    ORA920_LINUX3.IDEVELOPMENT.INFO = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = linux3.idevelopment.info) (PORT = 1521) ) ) (CONNECT_DATA = (SID = ORA920) ) ) ORA920_LINUX4.IDEVELOPMENT.INFO = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = linux4.idevelopment.info) (PORT = 1521) ) ) (CONNECT_DATA = (SID = ORA920) ) )

    Now, you will need to setup the listener.ora file on the primary (target) host:

    Listener.ora File on the Primary Host

    LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = linux3.idevelopment.info)(PORT = 1521)) ) (PROTOCOL_STACK = (PRESENTATION = TTC) (SESSION = NS) ) ) (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) (PROTOCOL_STACK = (PRESENTATION = TTC) (SESSION = NS) ) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/product/9.2.0) (PROGRAM = extproc) (ENVS="EXTPROC_DLLS=ANY") ) (SID_DESC = (GLOBAL_DBNAME = ORA920_LINUX3.IDEVELOPMENT.INFO) (SID_NAME = ORA920) (ORACLE_HOME = /u01/app/oracle/product/9.2.0) ) )

    Once the Oracle networking files are configured for the primary (target) database host, ensure to start the TNS listener with the latest (valid) listener.ora file:

    $ lsnrctl stop
    $ lsnrctl start


    Now, you will need to setup the listener.ora file for the standby host. The listener.ora file can be copied from the primary database server with only several changes that need to be performed. I have marked the changes that will need to be made in RED.

    Listener.ora File on the Standby Host

    LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = linux4.idevelopment.info)(PORT = 1521)) ) (PROTOCOL_STACK = (PRESENTATION = TTC) (SESSION = NS) ) ) (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) (PROTOCOL_STACK = (PRESENTATION = TTC) (SESSION = NS) ) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/product/9.2.0) (PROGRAM = extproc) (ENVS="EXTPROC_DLLS=ANY") ) (SID_DESC = (GLOBAL_DBNAME = ORA920_LINUX4.IDEVELOPMENT.INFO) (SID_NAME = ORA920) (ORACLE_HOME = /u01/app/oracle/product/9.2.0) ) )

    Finally, you should set the dead connection detection in the sqlnet.ora file. Here is an example sqlnet.ora file:

    Sqlnet.ora File on the Standby Host

    NAMES.DIRECTORY_PATH= (TNSNAMES, LDAP) BEQUEATH_DETACH=yes AUTOMATIC_IPC = ON NAMES.DEFAULT_DOMAIN = IDEVELOPMENT.INFO SQLNET.EXPIRE_TIME=2

    Once the Oracle networking files are configured for the standby (auxiliary) database host, ensure to start the TNS listener with the latest (valid) listener.ora file:

    $ lsnrctl stop
    $ lsnrctl start


  10. Mount or Open the Target Database

    As mentioned in the pre-requisites section of this article, the target database must be either opened or mounted.

    $ ORACLE_SID=ORA920; export ORACLE_SID
    $ sqlplus "/ as sysdba"
    SQL> startup open


  11. Ensure You Have the Necessary Backups and Archived Redo Log Files

    As mentioned in the pre-requisites section of this article, ensure that you have a current backup that you wish to use to create the standby database. Login to query the RMAN catalog. In the following example, you will see that I not only have a full backup of the database, but now also have a backup copy of the current control file (for standby) and all archived redo logs that have been created in the above steps:

    RMAN> list backup summary;
    
    List of Backups
    ===============
    Key     TY LV S Device Type Completion Time #Pieces #Copies Tag
    ------- -- -- - ----------- --------------- ------- ------- ---
    49      B  F  A DISK        04-JAN-05       1       1       TAG20050104T160515
    50      B  A  A DISK        04-JAN-05       1       1       TAG20050104T160821
    51      B  F  A DISK        04-JAN-05       1       1
    52      B  F  A DISK        04-JAN-05       1       1       TAG20050104T160936
    53      B  F  A DISK        04-JAN-05       1       1
    54      B  A  A DISK        04-JAN-05       1       1       TAG20050104T161252


  12. Create Standby Database

    Login to target (primary) and (standby) auxiliary database using RMAN. All of this should be performed from the target database server. In order to perform this section, you will need the last log sequence number you recorded earlier in this article.

    NOTE: Notice that the parameter NOFILENAMECHECK must be used when you are duplicating a database to a different host with the same file system (directory structure).

    Run the following:

    $ rman target sys/change_on_install@ORA920_LINUX3 auxiliary sys/change_on_install@ORA920_LINUX4
    
    Recovery Manager: Release 9.2.0.5.0 - Production
    
    Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
    
    connected to target database: ORA920 (DBID=2542332757)
    connected to auxiliary database: ORA920 (not mounted)
    
    RMAN>


    The following RUN block can be used to fully duplicate the target database from the latest full backup. This will create the standby database:

    run {
        # Set the last log sequence number
        set until sequence = 208 thread = 1;
    
        # Allocate the channel for the duplicate work
        allocate auxiliary channel ch1 type disk;
    
        # Duplicate the database to ORA920
        duplicate target database for standby dorecover nofilenamecheck ;
    }
    
    executing command: SET until clause
    using target database controlfile instead of recovery catalog
    
    allocated channel: ch1
    channel ch1: sid=14 devtype=DISK
    
    Starting Duplicate Db at 04-JAN-05
    
    printing stored script: Memory Script
    {
       restore clone standby controlfile to clone_cf;
       replicate clone controlfile from clone_cf;
       sql clone 'alter database mount standby database';
    }
    executing script: Memory Script
    
    Starting restore at 04-JAN-05
    
    channel ch1: starting datafile backupset restore
    channel ch1: restoring controlfile
    output filename=/u03/app/oradata/ORA920/control01.ctl
    channel ch1: restored backup piece 1
    piece handle=/orabackup/rman/ORA920/stby_cfile.1lg9c9e0_1_1 tag=TAG20050104T160936 params=NULL
    channel ch1: restore complete
    Finished restore at 04-JAN-05
    
    replicating controlfile
    input filename=/u03/app/oradata/ORA920/control01.ctl
    output filename=/u04/app/oradata/ORA920/control02.ctl
    output filename=/u05/app/oradata/ORA920/control03.ctl
    
    sql statement: alter database mount standby database
    
    printing stored script: Memory Script
    {
       set until scn  25005477;
       set newname for datafile  1 to
     "/u06/app/oradata/ORA920/system01.dbf";
       set newname for datafile  2 to
     "/u06/app/oradata/ORA920/undotbs1_01.dbf";
       set newname for datafile  3 to
     "/u06/app/oradata/ORA920/cwmlite01.dbf";
       set newname for datafile  4 to
     "/u06/app/oradata/ORA920/drsys01.dbf";
       set newname for datafile  5 to
     "/u06/app/oradata/ORA920/indx01.dbf";
       set newname for datafile  6 to
     "/u06/app/oradata/ORA920/odm01.dbf";
       set newname for datafile  7 to
     "/u06/app/oradata/ORA920/tools01.dbf";
       set newname for datafile  8 to
     "/u06/app/oradata/ORA920/users01.dbf";
       set newname for datafile  9 to
     "/u06/app/oradata/ORA920/xdb01.dbf";
       set newname for datafile  10 to
     "/u06/app/oradata/ORA920/example01.dbf";
       set newname for datafile  11 to
     "/u06/app/oradata/ORA920/perfstat01.dbf";
       set newname for datafile  12 to
     "/u06/app/oradata/ORA920/users02.dbf";
       restore
       check readonly
       clone database
       ;
    }
    executing script: Memory Script
    
    executing command: SET until clause
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    executing command: SET NEWNAME
    
    Starting restore at 04-JAN-05
    
    channel ch1: starting datafile backupset restore
    channel ch1: specifying datafile(s) to restore from backup set
    restoring datafile 00001 to /u06/app/oradata/ORA920/system01.dbf
    restoring datafile 00002 to /u06/app/oradata/ORA920/undotbs1_01.dbf
    restoring datafile 00003 to /u06/app/oradata/ORA920/cwmlite01.dbf
    restoring datafile 00004 to /u06/app/oradata/ORA920/drsys01.dbf
    restoring datafile 00005 to /u06/app/oradata/ORA920/indx01.dbf
    restoring datafile 00006 to /u06/app/oradata/ORA920/odm01.dbf
    restoring datafile 00007 to /u06/app/oradata/ORA920/tools01.dbf
    restoring datafile 00008 to /u06/app/oradata/ORA920/users01.dbf
    restoring datafile 00009 to /u06/app/oradata/ORA920/xdb01.dbf
    restoring datafile 00010 to /u06/app/oradata/ORA920/example01.dbf
    restoring datafile 00011 to /u06/app/oradata/ORA920/perfstat01.dbf
    restoring datafile 00012 to /u06/app/oradata/ORA920/users02.dbf
    channel ch1: restored backup piece 1
    piece handle=/orabackup/rman/ORA920/backup_db_ORA920_S_50_P_1_T_546710715 tag=TAG20050104T160515 params=NULL
    channel ch1: restore complete
    Finished restore at 04-JAN-05
    
    printing stored script: Memory Script
    {
       switch clone datafile all;
    }
    executing script: Memory Script
    
    datafile 2 switched to datafile copy
    input datafilecopy recid=25 stamp=546711202 filename=/u06/app/oradata/ORA920/undotbs1_01.dbf
    datafile 3 switched to datafile copy
    input datafilecopy recid=26 stamp=546711202 filename=/u06/app/oradata/ORA920/cwmlite01.dbf
    datafile 4 switched to datafile copy
    input datafilecopy recid=27 stamp=546711202 filename=/u06/app/oradata/ORA920/drsys01.dbf
    datafile 5 switched to datafile copy
    input datafilecopy recid=28 stamp=546711202 filename=/u06/app/oradata/ORA920/indx01.dbf
    datafile 6 switched to datafile copy
    input datafilecopy recid=29 stamp=546711202 filename=/u06/app/oradata/ORA920/odm01.dbf
    datafile 7 switched to datafile copy
    input datafilecopy recid=30 stamp=546711202 filename=/u06/app/oradata/ORA920/tools01.dbf
    datafile 8 switched to datafile copy
    input datafilecopy recid=31 stamp=546711202 filename=/u06/app/oradata/ORA920/users01.dbf
    datafile 9 switched to datafile copy
    input datafilecopy recid=32 stamp=546711202 filename=/u06/app/oradata/ORA920/xdb01.dbf
    datafile 10 switched to datafile copy
    input datafilecopy recid=33 stamp=546711202 filename=/u06/app/oradata/ORA920/example01.dbf
    datafile 11 switched to datafile copy
    input datafilecopy recid=34 stamp=546711202 filename=/u06/app/oradata/ORA920/perfstat01.dbf
    datafile 12 switched to datafile copy
    input datafilecopy recid=35 stamp=546711203 filename=/u06/app/oradata/ORA920/users02.dbf
    
    printing stored script: Memory Script
    {
       set until scn  25005477;
       recover
       standby
       clone database
        delete archivelog
       ;
    }
    executing script: Memory Script
    
    executing command: SET until clause
    
    Starting recover at 04-JAN-05
    
    starting media recovery
    
    channel ch1: starting archive log restore to default destination
    channel ch1: restoring archive log
    archive log thread=1 sequence=206
    channel ch1: restored backup piece 1
    piece handle=/orabackup/rman/ORA920/backup_db_ORA920_S_51_P_1_T_546710901 tag=TAG20050104T160821 params=NULL
    channel ch1: restore complete
    archive log filename=/u06/app/oradata/ORA920/archive/arch_t1_s206.dbf thread=1 sequence=206
    channel clone_default: deleting archive log(s)
    archive log filename=/u06/app/oradata/ORA920/archive/arch_t1_s206.dbf recid=1 stamp=546711207
    channel ch1: starting archive log restore to default destination
    channel ch1: restoring archive log
    archive log thread=1 sequence=207
    channel ch1: restored backup piece 1
    piece handle=/orabackup/rman/ORA920/backup_db_ORA920_S_55_P_1_T_546711173 tag=TAG20050104T161252 params=NULL
    channel ch1: restore complete
    archive log filename=/u06/app/oradata/ORA920/archive/arch_t1_s207.dbf thread=1 sequence=207
    channel clone_default: deleting archive log(s)
    archive log filename=/u06/app/oradata/ORA920/archive/arch_t1_s207.dbf recid=2 stamp=546711209
    media recovery complete
    Finished recover at 04-JAN-05
    Finished Duplicate Db at 04-JAN-05
    released channel: ch1
    
    RMAN> exit


  13. Put the Standby in Managed Recovery Mode

    On the standby database, run the following:

    $ sqlplus "/ as sysdba"
    
    SQL> recover standby database;
    
    SQL> alter database recover managed standby database disconnect;
    
    Database altered.


Copyright (c) 1998-2017 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Saturday, 18-Sep-2010 17:34:11 EDT
Page Count: 16593