Duplicating Database using RMAN duplicate command
| Article Index |
|---|
| 1. Duplicate and Standby databases |
| 2. Process of Duplication |
| 3. Creating a Duplicate Database with RMAN: |
| 4. Backup and archive log required for Duplicate: |
RMAN DUPLICATE command creates duplicate database from backups of the target database while retaining the original target database.
The duplicate database can be identical to the target database or contain only a subset of the table-spaces in the target database. The target site and the duplicate site can be on separate hosts or on the same host.
The Duplicate DB can run independently and used for several reasons for example:
- Test backup and recovery procedures
- Export data such as a table that was inadvertently dropped from the production database, and then import it back into the production database
1. Duplicate and Standby databases
- A duplicate database is distinct from a standby database, both are created with the DUPLICATE command.
- A standby DB is a copy of the primary database that continually update with archived logs from the primary DB.
- If the primary database is damaged or destroyed, then you can perform fail-over to the standby database and transform it into the new primary database.
- While duplicate database is not intended for fail-over scenarios and does not support the various standby recovery and fail-over options.
2. Process of Duplication
- Creates a control file for the duplicate database
- Restores the target data-files into the duplicate database and performs incomplete recovery using all available archived log and incremental backups.
- Shuts down and starts the auxiliary instance
- Opens the duplicate DB with the RESETLOGS option after incomplete recovery to create the online redo logs.
- Generates a new, unique database identifier for the duplicate database
During duplication, RMAN must perform incomplete recovery because the online redo logs in the target are not backed up and cannot be applied to the duplicate database. The farthest that RMAN can go in recovery of the duplicate database is the most recent redo log archived by the target database.
3. Creating a Duplicate Database with RMAN:
- You must connect RMAN to both the target (primary) database and an auxiliary instance started in NOMOUNT mode
- Allocate at least one auxiliary channel on the auxiliary instance.
- This starts a server session on the duplicate host.
This channel then restores the necessary backups of the primary database
- and initiates recovery
4. Backup and archive log required for Duplicate:
- Last full backup and archive log are required for duplication.
- Parameters file for starting new instance.
- RMAN client can run on any host. All backups and archived logs, must be accessible on duplicate host
- If the duplicate host is not the same as the target host, then copy backups and archive log to duplicate host with the same full path as in the primary database. Two options can be used
- Manually transfer files from the primary host to the remote host to an identical path.
- Manually transfer the backups from the primary host to the duplicate host at a new location. Run the CATALOG command to add these copies to the RMAN repository at the duplicate host.
Decide the Duplicate Database name for example (LHDUP)
1 |
GB IN BYTE DIVIDE MB |
STEP – 0 Installation of Oracle Database software on duplicate host
Install oracle database software on duplicate host if required where you want to create duplicate database. For example
1 |
Screen 1: Type of installation = Enterprise Edition |
STEP – 1 Create an Oracle Password File for the Auxiliary Instance
Create a password file on duplicate host using password file utility. This password file will be used in creation of new auxiliary instance.
Orapwd file=C:\oracle\product\10.2.0\db_1\DATABASE\PWDLHDUP.ora password=DUP
STEP – 2 Create an Initialization Parameter File for the Auxiliary Instance
Use following list of commands to create parameters file using target DB. This file will be used in creation of new auxiliary instance.
Login to Target DB
1 |
SQL > SYS/****@LHR AS SYSDB |
The file will be created on target host copy or move newly created file to duplicate host following location.
1 |
’C:\oracle\product\10.2.0\db_1\DATABASE\initLHDUP.ora’
|
Modify parameters. All path parameter should be accessible on duplicate host.
1 |
db_name='LHDUP' |
Create directory structure on duplicate host
Directory structure for target host (will be used to keep backups and archive logs for duplication)
1 |
MKDIR F:\flash_recovery_area\LHDB\BACKUPSET |
New Directory structure for duplicate host (or use batch file provided)
1 |
MKDIR C:\oracle_data_files\LHDUP\oradata |
STEP – 3 Create Auxiliary Instance
1 |
Cmd |
STEP – 4 Establish Oracle Net Connectivity to the Auxiliary Instance ( on duplicate host)
- Add listener on duplicate host if not already added using “Oracle net configuration assistant” wizard
- Modify Listener.ora file using “Net manager utility“ to add auxiliary instance.
1 |
LISTENER > DATABASE services > ADD DATABASE |
- Save configuration and exit ( restart listener service)
- Modify tnsnames.ora file to add following services
1 |
LHDUP = # Net connection for Auxiliary instance (required) |
STEP – 5 Start Auxiliary Instance
1 |
C:\> sqlplus "sys/change_on_install@lhdup as sysdba" |
STEP – 6 Mount or Open the Target Database (optional if target Db is not opened)
1 |
C:\> sqlplus "sys/*****@lhr as sysdba" |
STEP – 7 Available Necessary backups and archive logs
Ensure that you have current level 0 backup and level 1 backup and archive logs after level 0 backup.
STEP – 8 Login to Target and Auxiliary instance
1 |
RMAN |
STEP – 9 RUN RMAN DUPLICATE command
1 |
run { |
Last Updated (Wednesday, 23 December 2009 17:10)



