Applies to:
Goal
The following note will guide a user in creating a duplicate database on the same
host (non ASM). The scenario does not refer to a recovery catalog however a
catalog can also be used. The following example has been completed on a linux
box ITLINUXDEVBLADE07.
Solution
Steps
5. Creating the init.ora & administration directories for the duplicate database.
1
Author, Dali Gomes
RMAN restore on the same machine - different database name
:/opt/oracle>. setdgtest9i
dgtest9i:/opt/oracle> sql
Note the DBID and the forced logging entries after the duplication the DBID of
the new database will be different and forced logging will default to NO.
dgtest9i:/opt/oracle/admin/dupdb/rman>rman target /
2
Author, Dali Gomes
RMAN restore on the same machine - different database name
3
Author, Dali Gomes
RMAN restore on the same machine - different database name
dgtest9i:/opt/oracle/admin/dupdb/rman>rman target /
………………………………………………………………. ………………………
………………………………………………………………………………………..
4
Author, Dali Gomes
RMAN restore on the same machine - different database name
RMAN>exit
After deciding what you will be duplicating, calculate the entire space this will
required on the host.
1230 M - DATA
100 M - TEMP
30 M - LOGS
Prior to starting the duplicate process you must ensure you have enough disk
space within file system to hold the database.
dgtest9i:/opt/oracle>df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p8 4.9G 1.4G 3.2G 31% /
/dev/cciss/c0d0p2 25G 19G 4.4G 81% /opt
/dev/cciss/c0d0p11 14G 12G 2.1G 85% /u01
dgtest9i:/opt/oracle/admin/dupdb/rman>rman target /
5
Author, Dali Gomes
RMAN restore on the same machine - different database name
6
Author, Dali Gomes
RMAN restore on the same machine - different database name
Create the directory structure of the dump destinations and of the datafiles etc.
Also create set file.
An easy way to create the dump directories is to copy the existing primary
database dump directories and delete its contents
7
Author, Dali Gomes
RMAN restore on the same machine - different database name
FILESYSTEM
--------------------------------------------------------------------------------
/u01/
SQL> exit
Copy the original initora file of the primary database in this case initdgtest9i.ora
and replace all dgtest9i references to dupdb and make all necessary directory
changes.
*.background_dump_dest='/opt/oracle/admin/dupdb/bdump'
*.control_files='/u01/ORACLE/dupdb/control01.ctl'
*.core_dump_dest='/opt/oracle/admin/dupdb/cdump'
*.db_block_size=16384
*.db_cache_size=104857600
*.db_file_multiblock_read_count=8
*.db_file_name_convert='/u01/ORACLE/dgtest9i/','/u01/ORACLE/dupdb/'
*.db_name='dupdb'
*.java_pool_size=52428800
*.job_queue_processes=10
*.large_pool_size=8388608
*.log_archive_dest_1='LOCATION=/u01/ORACLE/dupdb/arch'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_format='arch%s.log'
*.log_archive_start=TRUE
*.log_buffer=1048576
*.log_checkpoints_to_alert=TRUE
*.log_file_name_convert='/u01/ORACLE/dgtest9i/','/u01/ORACLE/dupdb/'
*.shared_pool_size=104857600
8
Author, Dali Gomes
RMAN restore on the same machine - different database name
:/opt/oracle>. setdupdb
dupdb:/opt/oracle> cd $ORACLE_HOME/dbs
dupdb:/opt/oracle/product9204/dbs>orapwd file=orapwdupdb password=oracle
entries=5
dupdb:/opt/oracle/product9204/dbs>
dupdb:/opt/oracle/admin/dupdb/rman>sqlplus ‘sys/oracle@dgtest9i as
sysdba’
Using RMAN connect to the primary database to retrieve the SBT Channel
settings. This setting has to be included in the RMAN Duplicate script.
dgtest9i:/opt/oracle/admin/dupdb/rman>rman target /
9
Author, Dali Gomes
RMAN restore on the same machine - different database name
RMAN> exit
10
Author, Dali Gomes
RMAN restore on the same machine - different database name
run{
allocate channel C1 DEVICE TYPE 'SBT_TAPE' PARMS
'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.dgtest9id.opt
)';
allocate auxiliary channel aux1 device type 'SBT_TAPE' PARMS
'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.dgtest9id.opt
)';
SET UNTIL SEQUENCE 256 THREAD 1;
duplicate target database to dupdb;
}
Start the dupdb instance in NOMOUNT mode. This will be your auxiliary
instance.
:/opt/oracle> . setdupdb
dupdb:/opt/oracle> sql
Start RMAN, connect to the production target, the catalog instance and also the
auxiliary clone. Run the RMAN duplicate script as shown above. Before doing
this ensure that the Oracle SID environment variable is set to the duplicate clone
database.
11
Author, Dali Gomes
RMAN restore on the same machine - different database name
Open another duplicate OS session and navigate to the directory that has the log
file dupdb_creation.log and do a tail –f dupdb_creation.log to monitor the
progress of the duplication.
RMAN>
RMAN> run{
2> allocate channel C1 DEVICE TYPE 'SBT_TAPE' PARMS
'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.dgtest9id.opt)';
3> allocate auxiliary channel aux1 device type 'SBT_TAPE' PARMS
'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.dgtest9id.opt)';
4> SET UNTIL SEQUENCE 256 THREAD 1;
5> duplicate target database to dupdb;
6> }
using target database controlfile instead of recovery catalog
allocated channel: C1
channel C1: sid=15 devtype=SBT_TAPE
channel C1: Data Protection for Oracle: version 5.2.4.0
12
Author, Dali Gomes
RMAN restore on the same machine - different database name
13
Author, Dali Gomes
RMAN restore on the same machine - different database name
14
Author, Dali Gomes
RMAN restore on the same machine - different database name
MAXLOGMEMBERS 2
MAXDATAFILES 200
MAXINSTANCES 1
MAXLOGHISTORY 454
LOGFILE
GROUP 1 ( '/u01/ORACLE/dupdb/redo01.log' ) SIZE 10485760 REUSE,
GROUP 2 ( '/u01/ORACLE/dupdb/redo02.log' ) SIZE 10485760 REUSE,
GROUP 3 ( '/u01/ORACLE/dupdb/redo03.log' ) SIZE 10485760 REUSE
DATAFILE
'/u01/ORACLE/dupdb/system01.dbf'
CHARACTER SET US7ASCII
15
Author, Dali Gomes
RMAN restore on the same machine - different database name
database dismounted
Oracle instance shut down
16
Author, Dali Gomes
RMAN restore on the same machine - different database name
17
Author, Dali Gomes
RMAN restore on the same machine - different database name
18
Author, Dali Gomes
RMAN restore on the same machine - different database name
database opened
Finished Duplicate Db at 05-FEB-07
released channel: C1
RMAN> **end-of-file**
19
Author, Dali Gomes
RMAN restore on the same machine - different database name
NOTE: The DBID is changed and FORCED LOGGING is set to NO. and now
there are two pmon processes one for each database.
SQL> exit
After registering this database in the listener. You may do a TNS promote.
20