How To Create A Production Duplicate On a New Host using RMAN
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.
1 comment:
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!
Post a Comment