Rman hot cloning oracle database
source database : ora10gdb
target database (clone database) : clone5
your source database should be in archivelog mode
set up the environment and start the database and take backup of source database
[oracle@db10g ~]$ export ORACLE_SID=ora10gdb
[oracle@db10g ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Mon Jun 23 16:14:31 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SYS@ora10gdb>startup
ORACLE instance started.
Total System Global Area 1207959552 bytes
Fixed Size 2020352 bytes
Variable Size 318770176 bytes
Database Buffers 872415232 bytes
Redo Buffers 14753792 bytes
Database mounted.
Database opened.
SYS@ora10gdb>quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@db10g ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 – Production on Mon Jun 23 16:16:44 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10GDB (DBID=1868814969)
RMAN> backup database plus archivelog;
RMAN> quit
Recovery Manager complete.
connect to the source database and create pfile for clone5 database
[oracle@db10g ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Mon Jun 23 16:20:01 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, OLAP and Data Mining options
SYS@ora10gdb>create pfile=’$ORACLE_HOME/dbs/initclone5.ora’ from spfile;
File created.
Edit the pfile with new locations for controlfiles, datafile & logfiles and two important parameter for rman cloning
the contents after changing is as below
[oracle@db10g ~]$ cat $ORACLE_HOME/dbs/initclone5.ora
clone5.__db_cache_size=872415232
clone5.__db_cache_size=872415232
clone5.__java_pool_size=16777216
clone5.__java_pool_size=16777216
clone5.__large_pool_size=16777216
clone5.__large_pool_size=16777216
clone5.__shared_pool_size=285212672
clone5.__shared_pool_size=285212672
clone5.__streams_pool_size=0
clone5.__streams_pool_size=0
*.audit_file_dest=’/u01/app/oracle/product/10.2.0.1/db01/admin/clone5/adump’
*.background_dump_dest=’/u01/app/oracle/product/10.2.0.1/db01/admin/clone5/bdump’
*.compatible=’10.2.0.1.0′
*.control_files=’/u01/app/oracle/product/10.2.0.1/db01/oradata/clone5/control01.ctl’,’/u01/app/oracle/product/10.2.0.1/db01/oradata/clone5/control02.ctl’,’/u01/app/oracle/product/10.2.0.1/db01/oradata/clone5/control03.ctl’
*.core_dump_dest=’/u01/app/oracle/product/10.2.0.1/db01/admin/clone5/cdump’
*.db_block_size=8192
*.db_create_file_dest=’/u01/app/oracle/product/10.2.0.1/db01/oradata/clone5′
*.db_domain=”
*.db_file_multiblock_read_count=16
*.db_name=’clone5′
*.db_recovery_file_dest_size=2147483648
*.db_recovery_file_dest=’/u03/clone5/flash_recovery_area’
*.db_unique_name=’clone5′
*.dispatchers='(PROTOCOL=TCP) (SERVICE=clone5XDB)’
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=402653184
*.processes=150
*.remote_login_passwordfile=’EXCLUSIVE’
*.sga_target=1207959552
*.undo_management=’AUTO’
*.undo_tablespace=’UNDOTBS1′
*.user_dump_dest=’/u01/app/oracle/product/10.2.0.1/db01/admin/clone5/udump’
db_file_name_convert=’/u01/app/oracle/product/10.2.0.1/db01/oradata/ora10gdb01′,’/u01/app/oracle/product/10.2.0.1/oradata/clone5′ [very important parameter for rman cloning]
log_file_name_convert=’/u01/app/oracle/product/10.2.0.1/db01/oradata/ora10gdb01′,’/u01/app/oracle/product/10.2.0.1/oradata/clone5′ [very important parameter for rman cloning]
[oracle@db10g ~]$
Now create directories for clone5 database
[oracle@db10g ~]$ mkdir -p /u01/app/oracle/product/10.2.0.1/db01/admin/clone5/adump
[oracle@db10g ~]$ mkdir -p /u01/app/oracle/product/10.2.0.1/db01/admin/clone5/bdump
[oracle@db10g ~]$ mkdir -p /u01/app/oracle/product/10.2.0.1/db01/admin/clone5/cdump
[oracle@db10g ~]$ mkdir -p /u01/app/oracle/product/10.2.0.1/db01/admin/clone5/udump
[oracle@db10g ~]$ mkdir -p /u01/app/oracle/product/10.2.0.1/db01/oradata/clone5
[oracle@db10g ~]$ mkdir -p /u03/clone5/flash_recovery_area
[oracle@db10g ~]$
Create password file for clone5 database
[oracle@db10g ~]$ orapwd file=$ORACLE_HOME/dbs/orapwclone5 password=sys entries=5
configure the listener and tns. we have already created listener for source database now create for clone5 database
[oracle@db10g ~]$ netmgr
[oracle@db10g admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0.1/db01/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db01)
(SID_NAME = ora10gdb)
)
(SID_DESC =
(ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db01)
(SID_NAME = 10gdb02)
)
(SID_DESC =
(ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db01)
(SID_NAME = clone3)
)
(SID_DESC =
(ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db01)
(SID_NAME = clone4)
)
(SID_DESC =
(ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db01)
(SID_NAME = clone5)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db10g.localdomain)(PORT = 1521))
)
[oracle@db10g admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0.1/db01/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
CLONE5 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = db10g.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = clone5)
)
)
CLONE4 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = db10g.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = clone4)
)
)
CLONE3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = db10g.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = clone3)
)
)
ORA10GDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = db10g.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ora10gdb)
)
)
10GDB02 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = db10g.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = 10gdb02)
)
)
check using tnsping if you can ping source and clone
start clone5 database in nomount stage
[oracle@db10g admin]$ export ORACLE_SID=clone5
[oracle@db10g admin]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Mon Jun 23 19:36:11 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SYS@clone5>startup nomount
ORACLE instance started.
Total System Global Area 1207959552 bytes
Fixed Size 2020352 bytes
Variable Size 318770176 bytes
Database Buffers 872415232 bytes
Redo Buffers 14753792 bytes
SYS@clone5>quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@db10g admin]$
[oracle@db10g admin]$ export ORACLE_SID=ora10gdb
[oracle@db10g admin]$ rman target / auxiliary sys/sys@clone5
Recovery Manager: Release 10.2.0.1.0 – Production on Mon Jun 23 19:39:45 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10GDB (DBID=1868814969)
connected to auxiliary database: CLONE5 (not mounted)
RMAN> duplicate target database to ‘clone5’;
[oracle@db10g flash_recovery_area]$ export ORACLE_SID=clone5
[oracle@db10g flash_recovery_area]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Mon Jun 23 20:27:53 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, OLAP and Data Mining options
SYS@clone5>select name, open_mode from v$database;
NAME OPEN_MODE
——— ———-
CLONE5 READ WRITE
if you have any queries please feel free to write to me at sunil@sunilthetechfreak.com
Hello sir.. Nice article with detail.. coud you please tell me one thing.. do we need to copy database backup to new server with same location..?
Yes you need to copy location you can change