Saturday, June 7, 2014

Resynchroniaztion of auxiliary database

1.Configure the auxname clause for resynchronize the duplicate database(crman) with target database(cvrman)
Script to configure the auxname
connect target sys/sys123@cvrman;
connect auxiliary sys/sys123@crman;
run
{
configure auxname for datafile 1 to  '+DATA/crman/datafile/system.431.849623989';
configure auxname for datafile 2 to '+DATA/crman/datafile/sysaux.432.849623989';
configure auxname for datafile 3 to '+DATA/crman/datafile/undotbs1.442.849623989';
configure auxname for datafile 4 to '+DATA/crman/datafile/users.441.849623991';
configure auxname for datafile 5 to '+DATA/crman/datafile/example.443.849623989';
}


output of script execution of configuration of auxname clause
[oracle@ol6-112-rac2 rman]$ rman

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 7 15:04:14 2014

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

RMAN> @ rman_auxname.cmd

RMAN> connect target *
connected to target database: CVRMAN (DBID=659771233)

RMAN> connect auxiliary *
connected to auxiliary database: CRMAN (DBID=3195436963)

RMAN> run
2> {
3> configure auxname for datafile 1 to  '+DATA/crman/datafile/system.431.849623989';
4> configure auxname for datafile 2 to '+DATA/crman/datafile/sysaux.432.849623989';
5> configure auxname for datafile 3 to '+DATA/crman/datafile/undotbs1.442.849623989';
6> configure auxname for datafile 4 to '+DATA/crman/datafile/users.441.849623991';
7> configure auxname for datafile 5 to '+DATA/crman/datafile/example.443.849623989';
8> }
using target database control file instead of recovery catalog
auxiliary name for datafile 1 set to: +DATA/crman/datafile/system.431.849623989
new RMAN configuration parameters are successfully stored

auxiliary name for datafile 2 set to: +DATA/crman/datafile/sysaux.432.849623989
new RMAN configuration parameters are successfully stored

auxiliary name for datafile 3 set to: +DATA/crman/datafile/undotbs1.442.849623989
new RMAN configuration parameters are successfully stored

auxiliary name for datafile 4 set to: +DATA/crman/datafile/users.441.849623991
new RMAN configuration parameters are successfully stored

auxiliary name for datafile 5 set to: +DATA/crman/datafile/example.443.849623989
new RMAN configuration parameters are successfully stored

RMAN>
RMAN> **end-of-file**


2.Bounce the auxiliary database in nomount mode to start synchronization of the auxiliary database
[oracle@ol6-112-rac2 rman]$ export ORACLE_SID=crman
[oracle@ol6-112-rac2 rman]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jun 7 15:17:56 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> startup nomount force;
ORACLE instance started.

Total System Global Area  275578880 bytes
Fixed Size                  2227584 bytes
Variable Size             125829760 bytes
Database Buffers          142606336 bytes
Redo Buffers                4915200 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

3.Start synchronization of the auxiliary database using the script
connect target sys/sys123@cvrman;
connect auxiliary sys/sys123@crman;
duplicate target database to crman
logfile
group 1 ('+DATA/crman/onlinelog/group_1.440.849624527','+DATA/crman/onlinelog/group_1.439.849624529') size 52428800 reuse,
group 2 ('+DATA/crman/onlinelog/group_2.438.849624535','+DATA/crman/onlinelog/group_2.437.849624537') size 52428800 reuse,
group 3 ('+DATA/crman/onlinelog/group_3.424.849624539','+DATA/crman/onlinelog/group_3.423.849624541') size 52428800 reuse;

4.output of script execution
[oracle@ol6-112-rac2 rman]$ rman

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 7 15:18:58 2014

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

RMAN> @ rman_synchronize.cmd

RMAN> connect target *
connected to target database: CVRMAN (DBID=659771233)

RMAN> connect auxiliary *
connected to auxiliary database: CRMAN (not mounted)

RMAN> duplicate target database to crman
2> logfile
3> group 1 ('+DATA/crman/onlinelog/group_1.440.849624527','+DATA/crman/onlinelog/group_1.439.849624529') size 52428800 reuse,
4> group 2 ('+DATA/crman/onlinelog/group_2.438.849624535','+DATA/crman/onlinelog/group_2.437.849624537') size 52428800 reuse,
5> group 3 ('+DATA/crman/onlinelog/group_3.424.849624539','+DATA/crman/onlinelog/group_3.423.849624541') size 52428800 reuse;
Starting Duplicate Db at 07-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=1 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  control_files =
  ''+DATA/crman/controlfile/current.430.849623867'', ''+DATA/crman/controlfile/current.425.849623867'' comment=
 ''Set by RMAN'' scope=spfile";
   sql clone "alter system set  db_name =
 ''CVRMAN'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''CRMAN'' 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  control_files =   ''+DATA/crman/controlfile/current.430.849623867'', ''+DATA/crman/controlfile/current.425.849623867'' comment= ''Set by RMAN'' scope=spfile

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     275578880 bytes

Fixed Size                     2227584 bytes
Variable Size                125829760 bytes
Database Buffers             142606336 bytes
Redo Buffers                   4915200 bytes

Starting restore at 07-JUN-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=31 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 +DATA/cvrman/backupset/2014_06_07/ncsnf0_tag20140607t123328_0.421.849616993
channel ORA_AUX_DISK_1: piece handle=+DATA/cvrman/backupset/2014_06_07/ncsnf0_tag20140607t123328_0.421.849616993 tag=TAG20140607T123328
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
output file name=+DATA/crman/controlfile/current.430.849623867
output file name=+DATA/crman/controlfile/current.425.849623867
Finished restore at 07-JUN-14

database mounted

contents of Memory Script:
{
   set until scn  1111375;
   set newname for datafile  1 to
 "+DATA/crman/datafile/system.431.849623989";
   set newname for datafile  2 to
 "+DATA/crman/datafile/sysaux.432.849623989";
   set newname for datafile  3 to
 "+DATA/crman/datafile/undotbs1.442.849623989";
   set newname for datafile  4 to
 "+DATA/crman/datafile/users.441.849623991";
   set newname for datafile  5 to
 "+DATA/crman/datafile/example.443.849623989";
   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 07-JUN-14
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 +DATA/crman/datafile/system.431.849623989
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA/crman/datafile/sysaux.432.849623989
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA/crman/datafile/undotbs1.442.849623989
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA/crman/datafile/users.441.849623991
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA/crman/datafile/example.443.849623989
channel ORA_AUX_DISK_1: reading from backup piece +DATA/cvrman/backupset/2014_06_07/nnndf0_tag20140607t123328_0.436.849616431
channel ORA_AUX_DISK_1: piece handle=+DATA/cvrman/backupset/2014_06_07/nnndf0_tag20140607t123328_0.436.849616431 tag=TAG20140607T123328
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:05:25
Finished restore at 07-JUN-14

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=9 STAMP=849626794 file name=+DATA/crman/datafile/system.431.849623989
datafile 2 switched to datafile copy
input datafile copy RECID=10 STAMP=849626803 file name=+DATA/crman/datafile/sysaux.432.849623989
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=849626827 file name=+DATA/crman/datafile/undotbs1.442.849623989
datafile 4 switched to datafile copy
input datafile copy RECID=12 STAMP=849626828 file name=+DATA/crman/datafile/users.441.849623991
datafile 5 switched to datafile copy
input datafile copy RECID=13 STAMP=849626828 file name=+DATA/crman/datafile/example.443.849623989

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

executing command: SET until clause

Starting recover at 07-JUN-14
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 13 is already on disk as file +DATA/cvrman/archivelog/2014_06_07/thread_1_seq_13.419.849618387
archived log for thread 1 with sequence 14 is already on disk as file +DATA/cvrman/archivelog/2014_06_07/thread_1_seq_14.435.849618609
archived log for thread 1 with sequence 15 is already on disk as file +DATA/cvrman/archivelog/2014_06_07/thread_1_seq_15.434.849618643
archived log for thread 1 with sequence 16 is already on disk as file +DATA/cvrman/archivelog/2014_06_07/thread_1_seq_16.433.849618689
archived log file name=+DATA/cvrman/archivelog/2014_06_07/thread_1_seq_13.419.849618387 thread=1 sequence=13
archived log file name=+DATA/cvrman/archivelog/2014_06_07/thread_1_seq_14.435.849618609 thread=1 sequence=14
archived log file name=+DATA/cvrman/archivelog/2014_06_07/thread_1_seq_15.434.849618643 thread=1 sequence=15
archived log file name=+DATA/cvrman/archivelog/2014_06_07/thread_1_seq_16.433.849618689 thread=1 sequence=16
media recovery complete, elapsed time: 00:00:38
Finished recover at 07-JUN-14
Oracle instance started

Total System Global Area     275578880 bytes

Fixed Size                     2227584 bytes
Variable Size                125829760 bytes
Database Buffers             142606336 bytes
Redo Buffers                   4915200 bytes

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

Fixed Size                     2227584 bytes
Variable Size                125829760 bytes
Database Buffers             142606336 bytes
Redo Buffers                   4915200 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CRMAN" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1 ( '+DATA/crman/onlinelog/group_1.440.849624527', '+DATA/crman/onlinelog/group_1.439.849624529' ) SIZE 52428800    REUSE,
  GROUP   2 ( '+DATA/crman/onlinelog/group_2.438.849624535', '+DATA/crman/onlinelog/group_2.437.849624537' ) SIZE 52428800    REUSE,
  GROUP   3 ( '+DATA/crman/onlinelog/group_3.424.849624539', '+DATA/crman/onlinelog/group_3.423.849624541' ) SIZE 52428800    REUSE
 DATAFILE
  '+DATA/crman/datafile/system.431.849623989'
 CHARACTER SET WE8MSWIN1252


contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  "+DATA/crman/datafile/sysaux.432.849623989",
 "+DATA/crman/datafile/undotbs1.442.849623989",
 "+DATA/crman/datafile/users.441.849623991",
 "+DATA/crman/datafile/example.443.849623989";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to +data in control file

cataloged datafile copy
datafile copy file name=+DATA/crman/datafile/sysaux.432.849623989 RECID=1 STAMP=849626993
cataloged datafile copy
datafile copy file name=+DATA/crman/datafile/undotbs1.442.849623989 RECID=2 STAMP=849626999
cataloged datafile copy
datafile copy file name=+DATA/crman/datafile/users.441.849623991 RECID=3 STAMP=849627000
cataloged datafile copy
datafile copy file name=+DATA/crman/datafile/example.443.849623989 RECID=4 STAMP=849627000

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=849626993 file name=+DATA/crman/datafile/sysaux.432.849623989
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=849626999 file name=+DATA/crman/datafile/undotbs1.442.849623989
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=849627000 file name=+DATA/crman/datafile/users.441.849623991
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=849627000 file name=+DATA/crman/datafile/example.443.849623989

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

database opened
Finished Duplicate Db at 07-JUN-14

RMAN>
RMAN> **end-of-file**


1 comment: