step by step rman active clone diff server and with catalog and also without backups
db_name ------> source auxl catlog
ip-------------> 192.168.62.128 192.168.62.129 192.168.62.130
STEP 1.tns &listener
AT 'SERV1'
cd $ORACLE_HOME/network/admin/
[oracle@serv1 admin]$ cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.128)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = target)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
)
)
[oracle@serv1 admin]$ cat tnsnames.ora
target =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = target)
)
)
auxl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME =auxl)
)
)
catlog =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME =catlog)
)
)
AT 'SERV2'
cd $ORACLE_HOME/network/admin/
[oracle@serv2 admin]$ cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.129)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = auxl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
)
)
[oracle@serv2 admin]$ cat tnsnames.ora
target =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = target)
)
)
auxl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME =auxl)
)
)
catlog =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME =catlog)
)
)
AT 'SERV3'
cd $ORACLE_HOME/network/admin/
[oracle@serv3 admin]$ cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.130)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = catlog)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
)
)
[oracle@serv1 admin]$ cat tnsnames.ora
target =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = target)
)
)
auxl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME =auxl)
)
)
catlog =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME =catlog)
)
)
STEP 2.create auxiliary structure AT 'SERV2'
mkdir auxl
cd auxl
mkdir admin oradata admin/create admin/diag admin/pfile oradata/control oradata/log oradata/data oradata/archive
STEP 3.edit clone pfile only and not to source db
SQL> create pfile='/home/oracle/initauxl.ora' from spfile;
File created.
[oracle@serv1 ~]$ scp /home/oracle/initauxl.ora oracle@192.168.62.129:/home/oracle/axul/admin/pfile/
----------------------------------------------------------------
target pfile
db_name=source
sga_target=500m
control_files='/home/oracle/target /oradata/control/control01.ctl'
diagnostic_dest='/home/oracle/target /admin/diag'
undo_tablespace='UNDOWW'
-----------------------------------------------------------------
auxl pfile(auxilary) vi initauxl.ora
control_files='/home/oracle/auxl/oradata/control/control01.ctl'
db_name='auxl'
diagnostic_dest='/home/oracle/auxl/admin/diag'
sga_target=500m
db_file_name_convert='/home/oracle/target/oradata/data','/home/oracle/auxl/oradata/data'
log_file_name_convert='/home/oracle/target/oradata/log','/home/oracle/auxl/oradata/log' -----not necessary so remove this one may be ur choice
undo_tablespace='UNDOWW'
STEP 4. create password file
AT 'SERV1'
cd $ORACLE_HOME/dbs
export ORACLE_SID=target
orapwd file=orapwtarget password=sys force=y
AT 'SERV2'
cd $ORACLE_HOME/dbs
export ORACLE_SID=auxl
orapwd file=orapwauxl password=sys force=y
AT 'SERV3'
cd $ORACLE_HOME/dbs
export ORACLE_SID=catlog
orapwd file=orapwcatlog password=sys force=y
STEP 5.startup the auxiliary upto nomount
export ORACLE_SID=auxl
sqlplus / as sysdba
startup pfile='/home/oracle/auxl/admin/pfile/initauxl.ora' nomount;
STEP 5.CREATE REPOSITORY CATLOG USER AT CATLOG DATABASE AND CONNECT ALSO AUXILIARY DB(RUN BELOW SCRIPT) OR U CAN COPY AND PASTE LINE BY LINE.
vi ruser.sh at serv3
export ORACLE_SID=catlog
sqlplus / as sysdba <<EOF
startup;
alter system set db_create_file_dest='/home/oracle/catlog/oradata/data/' scope=spfile;
create tablespace tbs;
grant connect,resource,create session,recovery_catalog_owner to ruser identified by ruser;
alter user ruser default tablespace tbs quota unlimited on tbs;
!
EOF
rman target sys/sys@target auxiliary sys/sys@auxl catalog ruser/ruser@catlog
O/P:-
Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 7 23:45:25 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TARGET (DBID=3318562745)
connected to recovery catalog database
connected to auxiliary database: AUXL (not mounted)
STEP 6. AT catalog db
RMAN>run{
create catalog;
register database;
reset database;
resync catalog;
duplicate target database to auxl from active database nofilenamecheck;
}
--------------------------------------------------------------------------------------------------------------------------
Starting backup at 07-JUL-16
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/07/2016 23:50:23
RMAN-03015: error occurred in stored script Memory Script
RMAN-03014: implicit resync of recovery catalog failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20020: database incarnation not set
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete.
RMAN> reset database;
database incarnation already registered.
enter "before duplicat command"
---------->run again if fatal error comes remove undo if not exists came
---------------------------------------------------------------------------------------------------------------------------
Starting Duplicate Db at 08-JUL-16
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 523108352 bytes
Fixed Size 1337632 bytes
Variable Size 163579616 bytes
Database Buffers 352321536 bytes
Redo Buffers 5869568 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''TARGET'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''AUXL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/home/oracle/auxl/oradata/control/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''TARGET'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''AUXL'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 523108352 bytes
Fixed Size 1337632 bytes
Variable Size 163579616 bytes
Database Buffers 352321536 bytes
Redo Buffers 5869568 bytes
Starting backup at 08-JUL-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_target.f tag=TAG20160708T003059 RECID=4 STAMP=916619460
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 08-JUL-16
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"/home/oracle/auxl/oradata/data/system01.dbf";
set newname for datafile 2 to
"/home/oracle/auxl/oradata/data/systemaux01.dbf";
set newname for datafile 3 to
"/home/oracle/auxl/oradata/data/undo01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/home/oracle/auxl/oradata/data/system01.dbf" datafile
2 auxiliary format
"/home/oracle/auxl/oradata/data/systemaux01.dbf" datafile
3 auxiliary format
"/home/oracle/auxl/oradata/data/undo01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 08-JUL-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/home/oracle/target/oradata/data/system01.dbf
output file name=/home/oracle/auxl/oradata/data/system01.dbf tag=TAG20160708T003109
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/home/oracle/target/oradata/data/systemaux01.dbf
output file name=/home/oracle/auxl/oradata/data/systemaux01.dbf tag=TAG20160708T003109
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/home/oracle/target/oradata/data/undo01.dbf
output file name=/home/oracle/auxl/oradata/data/undo01.dbf tag=TAG20160708T003109
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
Finished backup at 08-JUL-16
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like "/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_66_916610617.dbf" auxiliary format
"/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_66_916610617.dbf" ;
catalog clone archivelog "/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_66_916610617.dbf";
switch clone datafile all;
}
executing Memory Script
Starting backup at 08-JUL-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=66 RECID=11 STAMP=916619656
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_66_916610617.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03
Finished backup at 08-JUL-16
cataloged archived log
archived log file name=/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_66_916610617.dbf RECID=11 STAMP=916619675
datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=916619678 file name=/home/oracle/auxl/oradata/data/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=5 STAMP=916619679 file name=/home/oracle/auxl/oradata/data/systemaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=916619679 file name=/home/oracle/auxl/oradata/data/undo01.dbf
contents of Memory Script:
{
set until scn 272824;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 08-JUL-16
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
starting media recovery
archived log for thread 1 with sequence 66 is already on disk as file /u01/app/oracle/product/11.2.0/db_1/dbs/arch1_66_916610617.dbf
archived log file name=/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_66_916610617.dbf thread=1 sequence=66
media recovery complete, elapsed time: 00:00:04
Finished recover at 08-JUL-16
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''AUXL'' 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 523108352 bytes
Fixed Size 1337632 bytes
Variable Size 163579616 bytes
Database Buffers 352321536 bytes
Redo Buffers 5869568 bytes
sql statement: alter system set db_name = ''AUXL'' 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 523108352 bytes
Fixed Size 1337632 bytes
Variable Size 163579616 bytes
Database Buffers 352321536 bytes
Redo Buffers 5869568 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUXL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/home/oracle/auxl/oradata/log/log01.log' ) SIZE 10 M REUSE,
GROUP 2 ( '/home/oracle/auxl/oradata/log/log02.log' ) SIZE 10 M REUSE
DATAFILE
'/home/oracle/auxl/oradata/data/system01.dbf'
CHARACTER SET US7ASCII
contents of Memory Script:
{
set newname for tempfile 1 to
"/home/oracle/auxl/oradata/data/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/home/oracle/auxl/oradata/data/systemaux01.dbf",
"/home/oracle/auxl/oradata/data/undo01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /home/oracle/auxl/oradata/data/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/home/oracle/auxl/oradata/data/systemaux01.dbf RECID=1 STAMP=916619739
cataloged datafile copy
datafile copy file name=/home/oracle/auxl/oradata/data/undo01.dbf RECID=2 STAMP=916619739
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=916619739 file name=/home/oracle/auxl/oradata/data/systemaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=916619739 file name=/home/oracle/auxl/oradata/data/undo01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 08-JUL-16
7) CHECK THE DBNAME OF AUXILIARY
errors:-
RMAN> duplicate target database to kfc3 from active database
error:-
RMAN-05001: auxiliary file name /u01/app/oracle/product/11.2.0/db_1/dbs/arch1_158_915559665.dbf conflicts
with a file used by the target database
solution:-
RMAN> duplicate target database to kfc3 from active database nofilenamecheck;
Comments
Post a Comment