In this workout we have,
Source database="ORACLE"
Duplicate database="CLONEDB"
Step-1:Create Password file for Auxiliary Database:
Step-2: Create Initializing parameter file for auxiliary database:
Step-3:Create/start Auxiliary database
Create a new Windows service for the duplicate database CLONEDB using oradim:
Source database="ORACLE"
Duplicate database="CLONEDB"
Step-1:Create Password file for Auxiliary Database:
C:\Documents and
Settings\suvdas>orapwd file='D:\app\EST_Suvendu\product\11.2.0\
dbhome_1\database\PWDclonedb'
password=managerStep-2: Create Initializing parameter file for auxiliary database:
SQL> create pfile='D:\app\EST_Suvendu\product\11.2.0\dbhome_1\database\initCLONEDB.ora' from spfile;
File created.
After creating the initialization parameter for the duplicate database, and change at leastthe following parameters:db_file_name_convert = ('D:\APP\EST_SUVENDU\oradata
\ORACLE', 'log_file_name_convert = ('D:\APP\EST_SUVENDU\oradata
\CLONEDB')D:\APP\EST_SUVENDU\oradata
\ORACLE', 'control_files = 'D:\APP\EST_SUVENDU\oradata
\CLONEDB')D:\APP\EST_SUVENDU\oradata
\CLONEDB\control01.ctl', 'D:\APP\EST_SUVENDU\oradata
\CLONEDB\control02.ctl', 'D:\APP\EST_SUVENDU\oradata
\CLONEDB\control03.ctl'db_name = 'CLONEDB' instance_name = 'CLONEDB' background_dump_dest = 'D:\APP\EST_SUVENDU
\admin\core_dump_dest = 'CLONEDB\bdump'D:\APP\EST_SUVENDU
\admin\user_dump_dest = 'CLONEDB\cdump'D:\APP\EST_SUVENDU
\admin\dispatchers = '(PROTOCOL=TCP) (SERVICE=CLONEDBXDB)' log_archive_dest_1 = 'location=CLONEDB\udump'D:\APP\EST_SUVENDU\oradata
\CLONEDB\archive MANDATORY'
Step-3:Create/start Auxiliary database
Create a new Windows service for the duplicate database CLONEDB using oradim:
C:\Documents and Settings\suvdas> mkdir D:\APP\EST_SUVENDU\oradata\CLONEDB C:\Documents and Settings\suvdas> mkdir D:\APP\EST_SUVENDU\oradata\CLONEDB\archive C:\Documents and Settings\suvdas> mkdir D:\APP\EST_SUVENDU\admin\CLONEDB\bdump C:\Documents and Settings\suvdas> mkdir D:\APP\EST_SUVENDU\admin\CLONEDB\bdump C:\Documents and Settings\suvdas> mkdir D:\APP\EST_SUVENDU\admin\CLONEDB\create C:\Documents and Settings\suvdas> mkdir D:\APP\EST_SUVENDU\admin\CLONEDB\bdump\pfile C:\Documents and Settings\suvdas> mkdir D:\APP\EST_SUVENDU\admin\CLONEDB\bdump\scripts C:\Documents and Settings\suvdas> mkdir D:\APP\EST_SUVENDU\admin\CLONEDB\bdump\udump
C:\Documents and
Settings\suvdas>oradim -new -sid CLONEDB -intpwd manager -start
mode auto -pfile
'D:\app\EST_Suvendu\product\11.2.0\dbhome_1\database\initCLONEDB.ora
C:\Documents and Settings\suvdas>set ORACLE_SID=CLONEDB
C:\Documents and Settings\suvdas> sqlplus "/ as sysdba"
SQL> startup nomount
Step-4:
The listener file
should look like below:
# listener.ora
Network Configuration File: D:\app\EST_Suvendu\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle
configuration tools.
LOCALLSNR =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
10.10.10.52)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY =
EXTPROC1521))
)
)
SID_LIST_LOCALLSNR =
(SID_LIST =
(SID_DESC =
(SID_NAME =CLONEDB )
(ORACLE_HOME =
D:\app\EST_Suvendu\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS =
"EXTPROC_DLLS=ONLY:D:\app\EST_Suvendu\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(SID_NAME =oracle )
(ORACLE_HOME =
D:\app\EST_Suvendu\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS =
"EXTPROC_DLLS=ONLY:D:\app\EST_Suvendu\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
ADR_BASE_LOCALLSNR =
D:\app\EST_Suvendu
#CLRExtProc
Step-5: Mount/Open the source database "oracle" if not open,
C:\Documents and Settings\suvdas> set ORACLE_SID=ORACLE C:\Documents and Settings\suvdas> sqlplus "/ as sysdba" SQL> startup open
Step-6:
>rman sys/manager@oracle
auxiliary sys/manager@clonedb
it will connect to
RMAN session then give below commands:
RMAN>run {
# Allocate the channel for the duplicate
work
allocate auxiliary channel ch1 type disk;
# Duplicate the database to CLONEDB
duplicate target database to CLONEDB;
}
/////////
below are results of
cloning:
Redo Buffers 5804032 bytes
allocated channel:
ch1
channel ch1: SID=134
device type=DISK
contents of Memory
Script:
{
sql clone "alter system set db_name =
''ORACLE'' comment=
''Modified by RMAN duplicate''
scope=spfile";
sql clone "alter system set db_unique_name =
''CLONEDB'' comment=
''Modified by RMAN duplicate''
scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory
Script
sql statement: alter
system set db_name = ''ORACLE'' comment= ''Modified by RM
AN duplicate''
scope=spfile
sql statement: alter
system set db_unique_name = ''CLONEDB'' comment= ''Modifi
ed by RMAN
duplicate'' scope=spfile
Oracle instance shut
down
Oracle instance
started
Total System Global
Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 192938448 bytes
Database Buffers 335544320 bytes
Redo Buffers 5804032 bytes
allocated channel:
ch1
channel ch1: SID=134
device type=DISK
Starting restore at
13-MAY-13
channel ch1: starting
datafile backup set restore
channel ch1:
restoring control file
channel ch1: reading
from backup piece D:\APP\EST_SUVENDU\RMANBKP\C-1687975765-2
0130510-01.CTL
channel ch1: piece
handle=D:\APP\EST_SUVENDU\RMANBKP\C-1687975765-20130510-01.CT
L
tag=TAG20130510T144129
channel ch1: restored
backup piece 1
channel ch1: restore
complete, elapsed time: 00:00:01
output file
name=D:\APP\EST_SUVENDU\ORADATA\CLONEDB\CONTROL01.CTL
output file
name=D:\APP\EST_SUVENDU\ORADATA\CLONEDB\CONTROL02.CTL
Finished restore at
13-MAY-13
database mounted
contents of Memory
Script:
{
set until scn 1288024;
set newname for datafile 1 to
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\SYSTEM01.DBF";
set newname for datafile 2 to
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\SYSAUX01.DBF";
set newname for datafile 3 to
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\UNDOTBS01.DBF";
set newname for datafile 4 to
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\USERS01.DBF";
set newname for datafile 5 to
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\EXAMPLE01.DBF";
restore
clone database
;
}
executing Memory
Script
executing command:
SET until clause
executing command:
SET NEWNAME
executing command:
SET NEWNAME
executing command:
SET NEWNAME
executing command:
SET NEWNAME
executing command:
SET NEWNAME
Starting restore at
13-MAY-13
channel ch1: starting
datafile backup set restore
channel ch1:
specifying datafile(s) to restore from backup set
channel ch1:
restoring datafile 00002 to D:\APP\EST_SUVENDU\ORADATA\CLONEDB\SYSA
UX01.DBF
channel ch1:
restoring datafile 00003 to D:\APP\EST_SUVENDU\ORADATA\CLONEDB\UNDO
TBS01.DBF
channel ch1:
restoring datafile 00005 to D:\APP\EST_SUVENDU\ORADATA\CLONEDB\EXAM
PLE01.DBF
channel ch1: reading
from backup piece D:\APP\EST_SUVENDU\RMANBKP\10O99OUC_1_1.D
BF
channel ch1: piece
handle=D:\APP\EST_SUVENDU\RMANBKP\10O99OUC_1_1.DBF tag=TAG201
30510T144011
channel ch1: restored
backup piece 1
channel ch1: restore
complete, elapsed time: 00:00:25
channel ch1: starting
datafile backup set restore
channel ch1:
specifying datafile(s) to restore from backup set
channel ch1: restoring
datafile 00001 to D:\APP\EST_SUVENDU\ORADATA\CLONEDB\SYST
EM01.DBF
channel ch1:
restoring datafile 00004 to D:\APP\EST_SUVENDU\ORADATA\CLONEDB\USER
S01.DBF
channel ch1: reading
from backup piece D:\APP\EST_SUVENDU\RMANBKP\11O99OUE_1_1.D
BF
channel ch1: piece
handle=D:\APP\EST_SUVENDU\RMANBKP\11O99OUE_1_1.DBF tag=TAG201
30510T144011
channel ch1: restored
backup piece 1
channel ch1: restore
complete, elapsed time: 00:00:33
Finished restore at
13-MAY-13
contents of Memory
Script:
{
switch clone datafile all;
}
executing Memory
Script
datafile 1 switched
to datafile copy
input datafile copy
RECID=7 STAMP=815332942 file name=D:\APP\EST_SUVENDU\ORADATA
\CLONEDB\SYSTEM01.DBF
datafile 2 switched
to datafile copy
input datafile copy
RECID=8 STAMP=815332942 file name=D:\APP\EST_SUVENDU\ORADATA
\CLONEDB\SYSAUX01.DBF
datafile 3 switched
to datafile copy
input datafile copy
RECID=9 STAMP=815332943 file name=D:\APP\EST_SUVENDU\ORADATA
\CLONEDB\UNDOTBS01.DBF
datafile 4 switched
to datafile copy
input datafile copy
RECID=10 STAMP=815332943 file name=D:\APP\EST_SUVENDU\ORADAT
A\CLONEDB\USERS01.DBF
datafile 5 switched
to datafile copy
input datafile copy
RECID=11 STAMP=815332943 file name=D:\APP\EST_SUVENDU\ORADAT
A\CLONEDB\EXAMPLE01.DBF
contents of Memory
Script:
{
set until scn 1288024;
recover
clone database
delete archivelog
;
}
executing Memory
Script
executing command:
SET until clause
Starting recover at
13-MAY-13
starting media
recovery
archived log for
thread 1 with sequence 14 is already on disk as file D:\APP\EST
_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000014_0814898327.0001
archived log for
thread 1 with sequence 15 is already on disk as file D:\APP\EST
_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000015_0814898327.0001
archived log for
thread 1 with sequence 16 is already on disk as file D:\APP\EST
_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000016_0814898327.0001
archived log for
thread 1 with sequence 17 is already on disk as file D:\APP\EST
_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000017_0814898327.0001
archived log for
thread 1 with sequence 18 is already on disk as file D:\APP\EST
_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000018_0814898327.0001
archived log for
thread 1 with sequence 19 is already on disk as file D:\APP\EST
_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000019_0814898327.0001
archived log file
name=D:\APP\EST_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000014_0
814898327.0001
thread=1 sequence=14
archived log file
name=D:\APP\EST_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000015_0
814898327.0001
thread=1 sequence=15
archived log file
name=D:\APP\EST_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000016_0
814898327.0001
thread=1 sequence=16
archived log file
name=D:\APP\EST_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000017_0
814898327.0001 thread=1
sequence=17
archived log file
name=D:\APP\EST_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000018_0
814898327.0001
thread=1 sequence=18
archived log file
name=D:\APP\EST_SUVENDU\ORADATA\ARCHIVE\ORACLE\ARC0000000019_0
814898327.0001
thread=1 sequence=19
media recovery
complete, elapsed time: 00:00:30
Finished recover at
13-MAY-13
contents of Memory
Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''CLONEDB'' comment=
''Reset to original value by RMAN''
scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory
Script
database dismounted
Oracle instance shut
down
connected to
auxiliary database (not started)
Oracle instance
started
Total System Global
Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 192938448 bytes
Database Buffers 335544320 bytes
Redo Buffers 5804032 bytes
allocated channel:
ch1
channel ch1: SID=133
device type=DISK
sql statement: alter
system set db_name = ''CLONEDB'' comment= ''Reset to orig
inal value by RMAN''
scope=spfile
sql statement: alter
system reset db_unique_name scope=spfile
Oracle instance shut
down
connected to
auxiliary database (not started)
Oracle instance
started
Total System Global
Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 192938448 bytes
Database Buffers 335544320 bytes
Redo Buffers 5804032 bytes
allocated channel:
ch1
channel ch1: SID=133
device type=DISK
sql statement: CREATE
CONTROLFILE REUSE SET DATABASE "CLONEDB" RESETLOGS ARCHIVE
LOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP
1 ( 'D:\APP\EST_SUVENDU\ORADATA\CLONEDB\REDO01.LOG' ) SIZE 50 M REUSE,
GROUP
2 ( 'D:\APP\EST_SUVENDU\ORADATA\CLONEDB\REDO02.LOG' ) SIZE 50 M REUSE,
GROUP
3 ( 'D:\APP\EST_SUVENDU\ORADATA\CLONEDB\REDO03.LOG' ) SIZE 50 M REUSE
DATAFILE
'D:\APP\EST_SUVENDU\ORADATA\CLONEDB\SYSTEM01.DBF'
CHARACTER SET AL32UTF8
contents of Memory
Script:
{
set newname for tempfile 1 to
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\TEMP01.DBF";
switch clone tempfile all;
catalog clone datafilecopy
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\SYSAUX01.DBF"
,
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\UNDOTBS01.DBF",
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\USERS01.DBF",
"D:\APP\EST_SUVENDU\ORADATA\CLONEDB\EXAMPLE01.DBF";
switch clone datafile all;
}
executing Memory
Script
executing command:
SET NEWNAME
renamed tempfile 1 to
D:\APP\EST_SUVENDU\ORADATA\CLONEDB\TEMP01.DBF in control f
ile
cataloged datafile
copy
datafile copy file
name=D:\APP\EST_SUVENDU\ORADATA\CLONEDB\SYSAUX01.DBF RECID=1
STAMP=815332990
cataloged datafile
copy
datafile copy file
name=D:\APP\EST_SUVENDU\ORADATA\CLONEDB\UNDOTBS01.DBF RECID=2
STAMP=815332990
cataloged datafile
copy
datafile copy file
name=D:\APP\EST_SUVENDU\ORADATA\CLONEDB\USERS01.DBF RECID=3 S
TAMP=815332990
cataloged datafile
copy
datafile copy file
name=D:\APP\EST_SUVENDU\ORADATA\CLONEDB\EXAMPLE01.DBF RECID=4
STAMP=815332990
datafile 2 switched
to datafile copy
input datafile copy
RECID=1 STAMP=815332990 file name=D:\APP\EST_SUVENDU\ORADATA
\CLONEDB\SYSAUX01.DBF
datafile 3 switched
to datafile copy
input datafile copy
RECID=2 STAMP=815332990 file name=D:\APP\EST_SUVENDU\ORADATA
\CLONEDB\UNDOTBS01.DBF
datafile 4 switched
to datafile copy
input datafile copy
RECID=3 STAMP=815332990 file name=D:\APP\EST_SUVENDU\ORADATA
\CLONEDB\USERS01.DBF
datafile 5 switched
to datafile copy
input datafile copy
RECID=4 STAMP=815332990 file name=D:\APP\EST_SUVENDU\ORADATA
\CLONEDB\EXAMPLE01.DBF
contents of Memory
Script:
{
Alter clone database open resetlogs;
}
executing Memory
Script
database opened
Finished Duplicate Db
at 13-MAY-13
released channel: ch1
RMAN>
RMAN> exit
Recovery Manager
complete.
C:\Documents and
Settings\suvdas>sqlplus
SQL*Plus: Release
11.2.0.1.0 Production on Mon May 13 17:27:55 2013
Copyright (c) 1982,
2010, Oracle. All rights reserved.
Enter user-name: sys
as sysdba
Enter password:
Connected to:
Oracle Database 11g
Enterprise Edition Release 11.2.0.1.0 - Production
With the
Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select name
from v$instance,v$database;
NAME
---------
CLONEDB
SQL> select
name,status from v$instance,v$database;
NAME STATUS
---------
------------
CLONEDB OPEN
SQL>
===============Hope it will help you================================
No comments:
Post a Comment