Duplicate Database
Source and target database are on same machine. mostly steps are same if source and duplicate database are different server. in that case you need to generate entry in tnsnames, create init file on both server.
Source database (RAC) – db11g
Duplicate database (SINGLE and then convert to RAC) – copy11g
Create static listener on node 1 of destination servers
vi /u01/oracle/ora11204/network/admin/listener.ora
SID_LIST_static_lsnr =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /u01/oracle/ora11204)
(SID_NAME = copy11g)
(GLOBAL_NAME = copy11g.wikidba.com)
)
)
lsnrctl start static_lsnr
lsnrctl status static_lsnr
Add entry in TNSNAMES.ora
vi /u01/oracle/ora11204/network/admin/tnsnames.ora
db11g_SRC.wikidba.com =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1.wikidba.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = db11g_1)
)
)
db11g_DUP.wikidba.com =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1.wikidba.com)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = copy11g)
)
)
Create init.ora on both servers in the same location
## On node1.wikidba.com logged in as oracle
$ vi /u01/oracle/ora11204/dbs/initcopy11g.ora
db_name=’copy11g’
db_unique_name=’copy11g’
audit_file_dest=’/acfs_mnt/audit’
diagnostic_dest=’/acfs_mnt’
audit_trail = DB
db_securefile = ALWAYS
nls_length_semantics = CHAR
open_cursors=600
processes=2000
sessions=2000
DB_CREATE_FILE_DEST=’+ORADATA1′
DB_RECOVERY_FILE_DEST=’+ORAFRA1′
DB_RECOVERY_FILE_DEST_SIZE=10G
log_archive_dest_1=’LOCATION=+ORADATA1 REOPEN=60′
cluster_database=’false’
compatible=’11.2.0.4.0′
memory_max_target=5G
memory_target=5G
Copy orapw file from node1 to node1 or create new one
$ cp /u01/oracle/ora11204/dbs/orapwdb11g /u01/oracle/ora11204/dbs/orapwcopy11g
OR
orapwd file=$ORACLE_HOME/dbs/orapwdb11g entries=30
Startup new instance in nomount on node1
$ vi /etc/oratab
copy11g:/u01/oracle/ora11204:N
. oraenv
ORACLE_SID = [copy11g] ? copy11g
export ORACLE_SID=copy11g
$ echo $ORACLE_HOME $ORACLE_SID
/u01/oracle/ora11204 copy11g
sqlplus / as sysdba
startup nomount PFILE=’/u01/oracle/ora11204/dbs/initcopy11g.ora’
Duplicate database using RMAN
export NLS_DATE_FORMAT=”DD-MON-YYYY HH24:MI:SS”
rman target sys@db11g_SRC.wikidba.com auxiliary sys@db11g_DUP.wikidba.com
set echo on
run {
allocate channel tgt1 device type disk;
allocate auxiliary channel aux1 device type disk;
duplicate target database to copy11g from active database
nofilenamecheck
pfile = /u01/oracle/ora11204/dbs/initcopy11g.ora;
}
shutdown immediate;
Additional task
Remove hidden parameter and deprecated parameter from initfile and spfile. create spfile from init file if needed. this is due to bug.
startup;
Delete Service Names of source database in duplicate database
set pages 0
select ‘exec dbms_service.delete_service(”’||name||”’);’ from dba_services where name not in ( ‘db11g’, ‘SYS$BACKGROUND’, ‘SYS$USERS’);