In this article, we will duplicate the database(with new db_name) from tape backup, without connecting to source database.
We will only connect to the recovery catalog and auxiliary instance.
SOURCE DB – PRODDB
AUXILIARY DB – TESTDB
CATALOG DB – ORACAT
I.e we will duplicat the database with db_name TESTDB from rman tape backup of PRODDB.
1. Prepare pfile for the new database.
export ORACLE_SID=TESTDB
cd $ORACLE_HOME/dbs
cat initTESTDB.ora
*.compatible='12.1.0.2.0' *.control_files='/archive/TESTDB/control01.ctl','/archive/TESTDB/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='TESTDB' *.diagnostic_dest='/oracle/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTDBXDB)' *.enable_ddl_logging=TRUE *.log_archive_dest_1='LOCATION=/archive/TESTDB/archive' .processes=800 *.remote_login_passwordfile='EXCLUSIVE' *.sec_case_sensitive_logon=FALSE *.sga_target=7500m *.undo_tablespace='UNDOTBS1' *.db_file_name_convert='/PRODDB/datafile/OMDEV1/','/archive/TESTDB/' *.log_file_name_convert='/PRODDB/datafile/OMDEV1/','/archive/TESTDB/'
Below two parameters are required, if the new database structure is different from the original database.
*.db_file_name_convert=’/PRODDB/datafile/OMDEV1/’,’/archive/TESTDB/’
*.log_file_name_convert=’/PRODDB/datafile/OMDEV1/’,’/archive/TESTDB/’
2. Connect to auxilary and catalog.
rman auxiliary / catalog RMAN_testhost/rman@oracat Recovery Manager: Release 12.1.0.2.0 - Production on Tue Oct 2 09:20:54 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to recovery catalog database connected to auxiliary database (not started)
3. Startup clone nomount:
RMAN> startup clone nomount; Oracle instance started Total System Global Area 7868514304 bytes Fixed Size 7651104 bytes Variable Size 2835349728 bytes Database Buffers 4882169856 bytes Redo Buffers 143343616 bytes
4. Now run the below-run block from RMAN.
Here we are doing point in time recovery, So we have mentioned timestamp also.
run { allocate auxiliary channel t1 type SBT_TAPE parms "ENV=(NSR_SERVER=dbtaperiy2,NSR_CLIENT=testhost)"; duplicate database PRODDB dbid 3445162686 to TESTDB until time "TO_DATE('2018-10-01 06:30:00','yyyy-mm-dd hh24:mi:ss')"; }
With this, our duplication has been completed. Our new database is ready for use.