For Oracle Server Enterprise Edition: 9.X,10.X
Goal:
How To Create A Production Duplicate On a New Host using RMAN
Solution:
Primary Database SID: ORCL
Duplicate Database SID: AUX
RMAN Catalog SID: RMAN
Backup of the primary database.
Host A (Target)
# export ORACLE_SID=ORCL
# rman target=/ catalog=rman/rman@ORCL
RMAN> run {
allocate channel d1 type disk;
backup format '/backups/PROD/df_t%t_s%s_p%p' database;
sql 'alter system archive log current';
backup format '/backups/PROD/al_t%t_s%s_p%p' archivelog all;
release channel d1;
}
This command will perform a full database backup including archivelogs and the current controlfile.
Host B (Aux)
Making the backup available for the duplicate process.
If your backup resides on disk you will need to copy this back up from host A to host B.
Ensure you place it in the same directory as where it was created.
RMAN> list backup;
Create same directory of host b and give appropriate permissions for the oracle user
Create the pfile [initAUX.ora] parameter file in the $ORACLE_HOME/dbs directory for
the auxiliary database.
---------------------------------------------------------------
db_name = aux
db_block_size = 8192
compatible = 10.2.0.1.0
remote_login_passwordfile = exclusive
control_files = ('/d02/oradata/aux/control01.ctl')
db_file_name_convert = ('/newpart/oradata/orcl',
'/d02/oradata/aux')
log_file_name_convert = ('/newpart/oradata/orcl',
'/d02/oradata/aux')
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
------------------------------------------------------------------------------
Following the creation of the initAUX.ora startup nomount the auxiliary instance.
export ORACLE_SID=AUX
sqlplus '/as sysdba'
startup nomount;
Ensuring SQL*NET connections to primary database and RMAN catalog are working.
Host B(AUX)
sqlplus ‘sys/oracle@PROD as sysdba’
sqlplus rman/rman@PROD (not mandatory)
Add tnsnames.ora entry
Eg:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oneapps.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
Prepare RMAN duplicate script.
run {
allocate auxiliary channel C1 device type disk;
duplicate target database to AUX;
}
Save it as dup.sql
Execute the RMAN script
Start RMAN, connect to the production target, the catalog instance and also the auxiliary clone. Run the RMAN duplicate script as shown below. Before doing this ensure that the Oracle SID environment variable is set to the duplicate clone database.
# export ORACLE_SID=AUX
# rman target sys/pwd@ORCL catalog rman/rman@ORCL auxiliary /
RMAN> @dup.sql
After this, login to aux database and alter database open with resetlogs option.
Saturday, June 28, 2008
Creating a Duplicate Database on a New Host Using RMAN
Posted by V.R.Kishore Reddy at 07:00