Monday, August 26, 2013

active database duplication from single host to RAC

# Added to the tnsnames.ora at source and destination server

ORCL1_SOURCE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = source_host.espdev.aurdev.national.com.au)(PORT = 1621))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL1)
    )
  )

#create a dummy pfile and start database in nomount state

[oracle@subhendb01 ~]$ echo $ORACLE_SID
ORCL1
[oracle@subhendb01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu May 23 16:47:15 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile='/oracle/app/database/11.2.0.3/dbhome_1/dbs/initORCL1.ora'
ORACLE instance started.

Total System Global Area  413429760 bytes
Fixed Size                  2228784 bytes
Variable Size             301993424 bytes
Database Buffers          100663296 bytes
Redo Buffers                8544256 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[oracle@subhendb01 ~]$ rman TARGET sys/xxxxxx@ORCL1_SOURCE AUXILIARY sys/xxxxxx@ORCL1_DESTINATION

Recovery Manager: Release 11.2.0.3.0 - Production on Thu May 23 16:47:48 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL1 (DBID=1763963481)
connected to auxiliary database: ORCL1 (not mounted)

RMAN> duplicate TARGET DATABASE TO ORCL1 FROM ACTIVE DATABASE
NOFILENAMECHECK
SPFILE
PARAMETER_VALUE_CONVERT='ORCL1','ORCL1'
SET db_file_name_convert='+DATA01/ORCL1','+R2BDATA/ORCL1'
SET log_file_name_convert='+DATA01/ORCL1','+R2BDATA/ORCL1','+DATA01/ORCL1','+R2BFRA/ORCL1'
set db_create_file_dest= '+R2BDATA'
set cluster_database='FALSE'
set DB_UNIQUE_NAME='ORCL1'
set instance_number='1'
set db_recovery_file_dest='+R2BFRA'
set SGA_TARGET='3G'
set PGA_AGGREGATE_TARGET='2G'
set processes='500'
set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.40.4.25)(PORT=1621))))'
reset MEMORY_TARGET
reset memory_max_target
SET CONTROL_FILES='+R2BDATA/ORCL1/control01.ctl','+R2BFRA/ORCL1/control01.ctl';

Starting Duplicate Db at 23-MAY-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=194 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '+DATA01/ORCL1/spfileORCL1.ora' auxiliary format
 '/oracle/app/database/11.2.0.3/dbhome_1/dbs/spfileORCL1.ora'   ;
   sql clone "alter system set spfile= ''/oracle/app/database/11.2.0.3/dbhome_1/dbs/spfileORCL1.ora''";
}
executing Memory Script

Starting backup at 23-MAY-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1186 device type=DISK
Finished backup at 23-MAY-13

sql statement: alter system set spfile= ''/oracle/app/database/11.2.0.3/dbhome_1/dbs/spfileORCL1.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''ORCL1'' comment=
 ''duplicate'' scope=spfile";
   sql clone "alter system set  audit_file_dest =
 ''/oracle/app/admin/ORCL1/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  dispatchers =
 ''(PROTOCOL=TCP) (SERVICE=ORCL1XDB)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''+DATA01/ORCL1'', ''+R2BDATA/ORCL1'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''+DATA01/ORCL1'', ''+R2BDATA/ORCL1'', ''+DATA01/ORCL1'', ''+R2BFRA/ORCL1'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_create_file_dest =
 ''+R2BDATA'' comment=
 '''' scope=spfile";
   sql clone "alter system set  cluster_database =
 FALSE comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''ORCL1'' comment=
 '''' scope=spfile";
   sql clone "alter system set  instance_number =
 1 comment=
 '''' scope=spfile";
   sql clone "alter system set  db_recovery_file_dest =
 ''+R2BFRA'' comment=
 '''' scope=spfile";
   sql clone "alter system set  SGA_TARGET =
 3G comment=
 '''' scope=spfile";
   sql clone "alter system set  PGA_AGGREGATE_TARGET =
 2G comment=
 '''' scope=spfile";
   sql clone "alter system set  processes =
 500 comment=
 '''' scope=spfile";
   sql clone "alter system set  local_listener =
 ''(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xx.xx.xx.25)(PORT=1621))))'' comment=
 '''' scope=spfile";
   sql clone "alter system reset  MEMORY_TARGET scope=spfile";
   sql clone "alter system reset  memory_max_target scope=spfile";
   sql clone "alter system set  CONTROL_FILES =
 ''+R2BDATA/ORCL1/control01.ctl'', ''+R2BFRA/ORCL1/control01.ctl'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''ORCL1'' comment= ''duplicate'' scope=spfile

sql statement: alter system set  audit_file_dest =  ''/oracle/app/admin/ORCL1/adump'' comment= '''' scope=spfile

sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=ORCL1XDB)'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''+DATA01/ORCL1'', ''+R2BDATA/ORCL1'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''+DATA01/ORCL1'', ''+R2BDATA/ORCL1'', ''+DATA01/ORCL1'', ''+R2BFRA/ORCL1'' comment= '''' scope=spfile

sql statement: alter system set  db_create_file_dest =  ''+R2BDATA'' comment= '''' scope=spfile

sql statement: alter system set  cluster_database =  FALSE comment= '''' scope=spfile

sql statement: alter system set  db_unique_name =  ''ORCL1'' comment= '''' scope=spfile

sql statement: alter system set  instance_number =  1 comment= '''' scope=spfile

sql statement: alter system set  db_recovery_file_dest =  ''+R2BFRA'' comment= '''' scope=spfile

sql statement: alter system set  SGA_TARGET =  3G comment= '''' scope=spfile

sql statement: alter system set  PGA_AGGREGATE_TARGET =  2G comment= '''' scope=spfile

sql statement: alter system set  processes =  500 comment= '''' scope=spfile

sql statement: alter system set  local_listener =  ''(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.40.4.25)(PORT=1621))))'' comment= '''' scope=spfile

sql statement: alter system reset  MEMORY_TARGET scope=spfile

sql statement: alter system reset  memory_max_target scope=spfile

sql statement: alter system set  CONTROL_FILES =  ''+R2BDATA/ORCL1/control01.ctl'', ''+R2BFRA/ORCL1/control01.ctl'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    3206836224 bytes

Fixed Size                     2232640 bytes
Variable Size               1291849408 bytes
Database Buffers            1895825408 bytes
Redo Buffers                  16928768 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''ORCL1'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''ORCL1'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '+R2BDATA/ORCL1/control01.ctl';
   restore clone controlfile to  '+R2BFRA/ORCL1/control01.ctl' from
 '+R2BDATA/ORCL1/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''ORCL1'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''ORCL1'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area    3206836224 bytes

Fixed Size                     2232640 bytes
Variable Size               1291849408 bytes
Database Buffers            1895825408 bytes
Redo Buffers                  16928768 bytes

Starting backup at 23-MAY-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/oracle/app/database/11.2.0.3/dbhome_1/dbs/snapcf_ORCL1.f tag=TAG20130523T164830 RECID=4 STAMP=816194910
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 23-MAY-13

Starting restore at 23-MAY-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=425 device type=DISK

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 23-MAY-13

database mounted
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

contents of Memory Script:
{
   set newname for datafile  1 to
 "+r2bdata";
   set newname for datafile  2 to
 "+r2bdata";
   set newname for datafile  3 to
 "+r2bdata";
   set newname for datafile  4 to
 "+r2bdata";
   set newname for datafile  5 to
 "+r2bdata";
   set newname for datafile  6 to
 "+r2bdata";
   set newname for datafile  7 to
 "+r2bdata";
   set newname for datafile  8 to
 "+r2bdata";
   set newname for datafile  9 to
 "+r2bdata";
   set newname for datafile  10 to
 "+r2bdata";
   set newname for datafile  11 to
 "+r2bdata";
   set newname for datafile  12 to
 "+r2bdata";
   set newname for datafile  13 to
 "+r2bdata";
   set newname for datafile  14 to
 "+r2bdata";
   set newname for datafile  15 to
 "+r2bdata";
   set newname for datafile  16 to
 "+r2bdata";
   set newname for datafile  17 to
 "+r2bdata";
   set newname for datafile  18 to
 "+r2bdata";
   backup as copy reuse
   datafile  1 auxiliary format
 "+r2bdata"   datafile
 2 auxiliary format
 "+r2bdata"   datafile
 3 auxiliary format
 "+r2bdata"   datafile
 4 auxiliary format
 "+r2bdata"   datafile
 5 auxiliary format
 "+r2bdata"   datafile
 6 auxiliary format
 "+r2bdata"   datafile
 7 auxiliary format
 "+r2bdata"   datafile
 8 auxiliary format
 "+r2bdata"   datafile
 9 auxiliary format
 "+r2bdata"   datafile
 10 auxiliary format
 "+r2bdata"   datafile
 11 auxiliary format
 "+r2bdata"   datafile
 12 auxiliary format
 "+r2bdata"   datafile
 13 auxiliary format
 "+r2bdata"   datafile
 14 auxiliary format
 "+r2bdata"   datafile
 15 auxiliary format
 "+r2bdata"   datafile
 16 auxiliary format
 "+r2bdata"   datafile
 17 auxiliary format
 "+r2bdata"   datafile
 18 auxiliary format
 "+r2bdata"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 23-MAY-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA01/ORCL1/datafile/sysaux.281.789556875
output file name=+R2BDATA/ORCL1/datafile/sysaux.3216.816194921 tag=TAG20130523T164841
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
.............
.............
.............
input datafile file number=00004 name=+DATA01/ORCL1/datafile/users.283.789556875
output file name=+R2BDATA/ORCL1/datafile/users.3233.816195025 tag=TAG20130523T164841
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 23-MAY-13

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "+DATA01/ORCL1/archivelog/2013_05_23/thread_1_seq_2293.359.816195027" auxiliary format
 "+R2BFRA"   ;
   catalog clone start with  "+R2BFRA";
   switch clone datafile all;
}
executing Memory Script

Starting backup at 23-MAY-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=2293 RECID=2290 STAMP=816195026
output file name=+R2BFRA/ORCL1/archivelog/2013_05_23/thread_1_seq_2293.15585.816195029 RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 23-MAY-13

searching for all files that match the pattern +R2BFRA

List of Files Unknown to the Database
=====================================
File Name: +r2bfra/CISOCH/CONTROLFILE/Backup.24219.816194287
File Name: +r2bfra/SNAPCF_DIR/snapcf_st6cas.f
File Name: +r2bfra/SNAPCF_DIR/snapcf_st66is.f


..................
..................
...................
File Name: +r2bfra/R2BINT/ONLINELOG/group_32.12018.815937759
  RMAN-07518: Reason: Foreign database file DBID: 2361498805  Database Name: R2BINT
File Name: +r2bfra/R2BINT/CONTROLFILE/Current.256.797689781
  RMAN-07518: Reason: Foreign database file DBID: 2361498805  Database Name: R2BINT

datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=816195536 file name=+R2BDATA/ORCL1/datafile/system.3217.816194947
datafile 2 switched to datafile copy
input datafile copy RECID=5 STAMP=816195536 file name=+R2BDATA/ORCL1/datafile/sysaux.3216.816194921
datafile 3 switched to datafile copy
...................
...................
....................
input datafile copy RECID=19 STAMP=816195537 file name=+R2BDATA/ORCL1/datafile/ecmcons_ocssearch.3225.816195005
datafile 17 switched to datafile copy
input datafile copy RECID=20 STAMP=816195537 file name=+R2BDATA/ORCL1/datafile/ecmcont_ocssearch.3226.816195009
datafile 18 switched to datafile copy
input datafile copy RECID=21 STAMP=816195537 file name=+R2BDATA/ORCL1/datafile/ecmcont_ocs.3219.816194969

contents of Memory Script:
{
   set until scn  46199166;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 23-MAY-13
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 2293 is already on disk as file +R2BFRA/ORCL1/archivelog/2013_05_23/thread_1_seq_2293.15585.816195029
archived log file name=+R2BFRA/ORCL1/archivelog/2013_05_23/thread_1_seq_2293.15585.816195029 thread=1 sequence=2293
media recovery complete, elapsed time: 00:00:00
Finished recover at 23-MAY-13
Oracle instance started

Total System Global Area    3206836224 bytes

Fixed Size                     2232640 bytes
Variable Size               1291849408 bytes
Database Buffers            1895825408 bytes
Redo Buffers                  16928768 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''ORCL1'' 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

sql statement: alter system set  db_name =  ''ORCL1'' 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    3206836224 bytes

Fixed Size                     2232640 bytes
Variable Size               1291849408 bytes
Database Buffers            1895825408 bytes
Redo Buffers                  16928768 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL1" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1 ( '+r2bdata', '+r2bdata' ) SIZE 50 M  REUSE,
  GROUP   2 ( '+r2bdata', '+r2bdata' ) SIZE 50 M  REUSE,
  GROUP   3 ( '+r2bdata', '+r2bdata' ) SIZE 50 M  REUSE
 DATAFILE
  '+R2BDATA/ORCL1/datafile/system.3217.816194947'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to
 "+r2bdata";
   set newname for tempfile  2 to
 "+r2bdata";
   set newname for tempfile  3 to
 "+r2bdata";
   set newname for tempfile  4 to
 "+r2bdata";
   set newname for tempfile  5 to
 "+r2bdata";
   set newname for tempfile  6 to
 "+r2bdata";
   set newname for tempfile  7 to
 "+r2bdata";
   switch clone tempfile all;
   catalog clone datafilecopy  "+R2BDATA/ORCL1/datafile/sysaux.3216.816194921",
 "+R2BDATA/ORCL1/datafile/undotbs1.3224.816195003",
 "+R2BDATA/ORCL1/datafile/users.3233.816195025",

 ......................
.......................
...................
 "+R2BDATA/ORCL1/datafile/ecmcont_ocssearch.3226.816195009",
 "+R2BDATA/ORCL1/datafile/ecmcont_ocs.3219.816194969";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to +r2bdata in control file
renamed tempfile 2 to +r2bdata in control file
renamed tempfile 3 to +r2bdata in control file
renamed tempfile 4 to +r2bdata in control file
renamed tempfile 5 to +r2bdata in control file
renamed tempfile 6 to +r2bdata in control file
renamed tempfile 7 to +r2bdata in control file

cataloged datafile copy
datafile copy file name=+R2BDATA/ORCL1/datafile/sysaux.3216.816194921 RECID=1 STAMP=816195564
......................
......................
cataloged datafile copy
datafile copy file name=+R2BDATA/ORCL1/datafile/ecmcont_ocs.3219.816194969 RECID=17 STAMP=816195564

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=816195564 file name=+R2BDATA/ORCL1/datafile/sysaux.3216.816194921
datafile 3 switched to datafile copy
................
................

datafile 18 switched to datafile copy
input datafile copy RECID=17 STAMP=816195564 file name=+R2BDATA/ORCL1/datafile/ecmcont_ocs.3219.816194969

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 23-MAY-13

RMAN>



No comments:

Post a Comment