Professional Documents
Culture Documents
: CRMS
: HRMS
: /u02/app/oracle/oradata/crms/
(SERVER1.ORACLE.COM) SERVER1
PRODUCTION
(SERVER2.ORACLE.COM) SERVER2
DEVELOPMENT
SOURCE SERVER
DBID
--------- ---------CRMS
1569424116
TYPE
VALUE
string
server1.com
TYPE
VALUE
--------- -----------------------------------------------------string
/u02/app/oracle/product/11.2.0/dbhome_1/dbs/spfilecrms.ora
crms.__pga_aggregate_target=503316480
crms.__sga_target=754974720
crms.__shared_io_pool_size=0
crms.__shared_pool_size=285212672
crms.__streams_pool_size=0
*.audit_file_dest='/u02/app/oracle/admin/crms/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u02/app/oracle/oradata/crms/control01.ctl','/u02/app/oracle/flash_recovery_area/crms/control02.ctl'
*.db_block_size=8192
*.db_domain='server1.com'
*.db_name='crms'
*.db_recovery_file_dest='/u02/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u02/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=crmsXDB)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=1244659712
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
AUXILIARY DATABASE PFILE
hrms.__db_cache_size=419430400
hrms.__java_pool_size=16777216
hrms.__large_pool_size=16777216
hrms.__oracle_base='/u02/app/oracle'
hrms.__pga_aggregate_target=503316480
hrms.__sga_target=754974720
hrms.__shared_io_pool_size=0
hrms.__shared_pool_size=285212672
hrms.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/hrms/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/hrms/control01.ctl', '/u01/app/oracle/flash_recovery_area/hrms/control02.ctl'
*.db_block_size=8192
*.db_domain='server2.com'
*.db_name='hrms'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=hrmsXDB)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=1244659712
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
# Below Parameters are used for from where to where the DATAFILES & LOGFILES will be cloned.
db_file_name_convert=('/u02/app/oracle/oradata/crms/', '/u01/app/oracle/oradata/hrms/)
log_file_name_convert=('/u02/app/oracle/oradata/crms/', '/u01/app/oracle/oradata/hrms/')
If the source database directory structure & clone database directory structure differs, then only
you need to use db_file_name_convert & log_file_name_convert parameters.
CREATE DIRECTORY STRUCTURE FOR AUXILIARY DATABASE
$ mkdir -p /u01/app/oracle/oradata/hrms/
$ mkdir -p /u01/app/oracle/admin/hrms/adump/
$ mkdir -p /u01/app/oracle/admin/hrms/dpdump/
$ mkdir -p /u01/app/oracle/flash_recovery_area/hrms
(CONNECT_DATA =
(SERVER=DEDICATED)
(SERVICE_NAME=crms)
)
)
HRMSDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST=192.168.1.131)(PORT=1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = hrms)
)
)
LISTENER.ORA ON AUXILIARY SERVER 192.168.1.131
listener
Version
Start Date
06-JAN-2015 00:30:41
Uptime
Trace Level
off
Security
SNMP
OFF
/u02/app/oracle/diag/tnslsnr/SERVER2/listener/alert/log.xml
listener
Version
Start Date
06-JAN-2015 00:30:48
Uptime
Trace Level
off
Security
SNMP
OFF
/u02/app/oracle/diag/tnslsnr/SERVER1/listener/alert/log.xml
SET THE SAME PASSWORD OF CLONE DATABASE INTO THE TARGET DATABASE
SYS> alter user sys identified by oracle;
(or)
$ cd $ORACLE_HOME/dbs
$ export ORACLE_SID=crms
[oracle@SERVER2 dbs]$ orapwd file=orapwcrms password=oracle entries=3 force=y
To create a password in target server, we can use alter user statement or orapwd utlity.
STARTUP AUXILIARY DATABASE AT NOMOUNT STAGE & EXIT
[oracle@SERVER2 ~]$ export ORACLE_SID=hrms
[oracle@SERVER2 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 6 01:52:05 2015
Copyright (c) 1982, 2009, Oracle.
1336232 bytes
Variable Size
822086744 bytes
Database Buffers
419430400 bytes
Redo Buffers
12619776 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
POINTS TO NOTE :
Once I started my auxiliary instance in NOMOUNT state, i have disconnected SYS as NO SESSION
before duplicating a database. It is must and should.
DUPLICATING TARGET DATABASE
In order to clone with the source database open and must be on archivelog mode. From 11g we can
clone databases using the from active database option. In this case we do NOT require an existing
backup, the active datafiles will be used as the source for the clone.
DUPLICATE TARGET DATABASE COMMAND PERFORMS THE FOLLOWING STEPS.
Creates an SPFILE.
Shuts down the instance and restarts it with the new spfile.
Restores the controlfile from the backup.
Mounts the database. Restore all datafiles.
RMAN creates all files in the converted names.
Recovers the datafiles up to the time specified and opens the database for availability.
CONNECT TO THE TARGET (SOURCE) & AUXILIARY (NEW CLONE) DATABASES USING RMAN
$ export ORACLE_SID=crms
$ rman target sys/oracle@CRMSDB auxiliary sys/orac1e@HRMSDB
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jan 6 01:52:55 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates.
1255473152 bytes
Fixed Size
1336232 bytes
Variable Size
838863960 bytes
Database Buffers
402653184 bytes
Redo Buffers
12619776 bytes
db_name =
''CRMS'' comment=
''Modified by RMAN duplicate'' scope=spfile";
db_unique_name =
''HRMS'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format
'/u01/app/oracle/oradata/hrms/control01.ctl' ;
restore clone controlfile to
'/u01/app/oracle/flash_recovery_area/hrms/control02.ctl' from
'/u01/app/oracle/oradata/hrms/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set
scope=s pfile
db_name =
db_unique_name =
1255473152 bytes
Fixed Size
1336232 bytes
Variable Size
838863960 bytes
Database Buffers
402653184 bytes
Redo Buffers
12619776 bytes
1 to
"/u01/app/oracle/oradata/hrms//system01.dbf";
2 to
"/u01/app/oracle/oradata/hrms//sysaux01.dbf";
set newname for datafile
3 to
"/u01/app/oracle/oradata/hrms//undotbs01.dbf";
set newname for datafile
4 to
"/u01/app/oracle/oradata/hrms//users01.dbf";
backup as copy reuse
datafile
1 auxiliary format
"/u01/app/oracle/oradata/hrms//system01.dbf"
datafile
2 auxiliary format
"/u01/app/oracle/oradata/hrms//sysaux01.dbf"
datafile
3 auxiliary format
"/u01/app/oracle/oradata/hrms//undotbs01.dbf"
datafile
4 auxiliary format
"/u01/app/oracle/oradata/hrms//users01.dbf"
1001716;
db_name =
''HRMS'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset
db_unique_name scope=spfile";
1255473152 bytes
Fixed Size
1336232 bytes
Variable Size
838863960 bytes
Database Buffers
402653184 bytes
Redo Buffers
12619776 bytes
db_name =
db_unique_name scope=spfile
1255473152 bytes
Fixed Size
1336232 bytes
Variable Size
838863960 bytes
Database Buffers
402653184 bytes
Redo Buffers
12619776 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "HRMS" RESETLOGS ARCHIVELOG
MAXLOGFILES
MAXLOGMEMBERS
16
3
MAXDATAFILES
100
MAXINSTANCES
MAXLOGHISTORY
292
LOGFILE
GROUP
1 ( '/u01/app/oracle/oradata/hrms//redo01.log' ) SIZE 50 M
REUSE,
GROUP
2 ( '/u01/app/oracle/oradata/hrms//redo02.log' ) SIZE 50 M
REUSE,
GROUP
3 ( '/u01/app/oracle/oradata/hrms//redo03.log' ) SIZE 50 M
REUSE
DATAFILE
'/u01/app/oracle/oradata/hrms/system01.dbf'
CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
set newname for tempfile
1 to
"/u01/app/oracle/oradata/hrms//temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy
"/u01/app/oracle/oradata/hrms/sysaux01.dbf",
"/u01/app/oracle/oradata/hrms/undotbs01.dbf",
"/u01/app/oracle/oradata/hrms/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/hrms//temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrms/sysaux01.dbf RECID=1 STAMP=868239296
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrms/undotbs01.dbf RECID=2 STAMP=868239296
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrms/users01.dbf RECID=3 STAMP=868239297
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=868239296 file name=/u01/app/oracle/oradata/hrms/sysaux01.dbf
DBID is different from the target database so it can be backed up independently and using the
same catalog as well.
SQL> select dbid from v$database;
DBID
---------916592507