step by step rman clone with same server and without catalog and with backup --oracle
target db_name auxiliary
db_name kfc kfc1
STEP 1.1.tns &listener
cd $ORACLE_HOME/network/admin/
[oracle@serv2 admin]$ cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = serv2.localdomain)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = kfc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
)
(SID_DESC =
(SID_NAME = kfc1)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
)
)
[oracle@serv2 admin]$ cat tnsnames.ora
kfc =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = serv2.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = kfc)
)
)
kfc1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = serv2.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = kfc1)
)
)
STEP 1.2 edit clone pfile only AND CREATE AUXILIARY STRUCTURE
SQL> create pfile='/home/oracle/kfc1/admin/pfile/initkfc1.ora' from spfile;
File created.
----------------------------------------------------------------
kfc pfile(target)
db_name=kfc
sga_target=800m
control_files='/home/oracle/kfc/oradata/control/control01.ctl'
diagnostic_dest='/home/oracle/kfc/admin/diag'
undo_tablespace='UNDOWW'
-----------------------------------------------------------------
Kfc1 pfile(auxilary)
control_files='/home/oracle/kfc1/oradata/control/control01.ctl'
db_name='kfc1'
diagnostic_dest='/home/oracle/kfc1/admin/diag'
sga_target=800m
db_file_name_convert='/home/oracle/kfc/oradata/data','/home/oracle/kfc1/oradata/data'
log_file_name_convert='/home/oracle/kfc/oradata/log','/home/oracle/kfc1/oradata/log' ---------- not necessary so delete this line only
undo_tablespace='UNDOWW'
STEP 2. create password file
cd $ORACLE_HOME/dbs
export ORACLE_SID=kfc
orapwd file=orapwkfc password=sys force=y
cp orapwkfc orapwkfc1
STEP 3. backup dattabase from source
rman target sys/sys@kfc
RMAN> backup database;
STEP 4.startup the clone db upto nomount
export ORACLE_SID=kfc1
sqlplus / as sysdba
startup pfile='/home/oracle/kfc1/admin/pfile/initkfc1.ora' nomount;
STEP 5. connect the rman auxiliary and target db.
AT SOURCE
[oracle@serv2 ~]$ rman target sys/sys@kfc auxiliary sys/sys@kfc1
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jul 5 23:42:58 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: KFC (DBID=1036556081)
connected to auxiliary database: KFC1 (not mounted)
step 6.execute last step
RMAN> duplicate target database to kfc1;
Starting Duplicate Db at 06-JUL-16
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 836976640 bytes
Fixed Size 1339740 bytes
Variable Size 234884772 bytes
Database Buffers 595591168 bytes
Redo Buffers 5160960 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''KFC'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''KFC1'' 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 = ''KFC'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''KFC1'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 836976640 bytes
Fixed Size 1339740 bytes
Variable Size 234884772 bytes
Database Buffers 595591168 bytes
Redo Buffers 5160960 bytes
Starting restore at 06-JUL-16
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/db_1/dbs/c-1036556081-20160705-05
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/db_1/dbs/c-1036556081-20160705-05 tag=TAG20160705T235555
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/home/oracle/kfc1/oradata/control/control01.ctl
Finished restore at 06-JUL-16
database mounted
contents of Memory Script:
{
set until scn 465570;
set newname for datafile 1 to
"/home/oracle/kfc1/oradata/data/system01.dbf";
set newname for datafile 2 to
"/home/oracle/kfc1/oradata/data/systemaux01.dbf";
set newname for datafile 3 to
"/home/oracle/kfc1/oradata/data/undo01.dbf";
set newname for datafile 4 to
"/home/oracle/kfc1/oradata/data/undoww.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
Starting restore at 06-JUL-16
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /home/oracle/kfc1/oradata/data/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /home/oracle/kfc1/oradata/data/systemaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /home/oracle/kfc1/oradata/data/undo01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /home/oracle/kfc1/oradata/data/undoww.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/db_1/dbs/0ar9vhuj_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/db_1/dbs/0ar9vhuj_1_1 tag=TAG20160705T225723
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:46
Finished restore at 06-JUL-16
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=916445224 file name=/home/oracle/kfc1/oradata/data/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=916445224 file name=/home/oracle/kfc1/oradata/data/systemaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=916445224 file name=/home/oracle/kfc1/oradata/data/undo01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=916445225 file name=/home/oracle/kfc1/oradata/data/undoww.dbf
contents of Memory Script:
{
set until scn 465570;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 06-JUL-16
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 187 is already on disk as file /u01/app/oracle/product/11.2.0/db_1/dbs/arch1_187_915559665.dbf
archived log for thread 1 with sequence 188 is already on disk as file /u01/app/oracle/product/11.2.0/db_1/dbs/arch1_188_915559665.dbf
archived log file name=/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_187_915559665.dbf thread=1 sequence=187
archived log file name=/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_188_915559665.dbf thread=1 sequence=188
media recovery complete, elapsed time: 00:00:06
Finished recover at 06-JUL-16
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''KFC1'' 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 836976640 bytes
Fixed Size 1339740 bytes
Variable Size 234884772 bytes
Database Buffers 595591168 bytes
Redo Buffers 5160960 bytes
sql statement: alter system set db_name = ''KFC1'' comment= ''Reset to original 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 836976640 bytes
Fixed Size 1339740 bytes
Variable Size 234884772 bytes
Database Buffers 595591168 bytes
Redo Buffers 5160960 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "KFC1" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/home/oracle/kfc1/oradata/log/log01.log' ) SIZE 10 M REUSE,
GROUP 2 ( '/home/oracle/kfc1/oradata/log/log02.log' ) SIZE 10 M REUSE
DATAFILE
'/home/oracle/kfc1/oradata/data/system01.dbf'
CHARACTER SET US7ASCII
contents of Memory Script:
{
set newname for tempfile 1 to
"/home/oracle/kfc1/oradata/data/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/home/oracle/kfc1/oradata/data/systemaux01.dbf",
"/home/oracle/kfc1/oradata/data/undo01.dbf",
"/home/oracle/kfc1/oradata/data/undoww.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /home/oracle/kfc1/oradata/data/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/home/oracle/kfc1/oradata/data/systemaux01.dbf RECID=1 STAMP=916445256
cataloged datafile copy
datafile copy file name=/home/oracle/kfc1/oradata/data/undo01.dbf RECID=2 STAMP=916445256
cataloged datafile copy
datafile copy file name=/home/oracle/kfc1/oradata/data/undoww.dbf RECID=3 STAMP=916445256
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=916445256 file name=/home/oracle/kfc1/oradata/data/systemaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=916445256 file name=/home/oracle/kfc1/oradata/data/undo01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=916445256 file name=/home/oracle/kfc1/oradata/data/undoww.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 06-JUL-16
step 7.check the db_name.
SQL> select global_name from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
KFC1
Comments
Post a Comment