Sunday, 12 February 2017

Rman backup based duplication with ReadOnly tablespaces, with different DB name and same directory structure.

Overview
Oracle Recovery Manager (RMAN) provides a comprehensive foundation for efficiently backing up and recovering the Oracle databases, it provides a common interface, via command line and Enterprise Manager, for backup tasks across different host operating systems, automates administration of your backup strategies.
In this scenario we have Readonly tablespace at target(Source) database. and same directory structure with different database name.




Target (source) details:

Database Name
prod
Hostname
Nsm-prod
Ip Address
172.16.110.18
OS
Linux
Version
x86_64
Datafile Location
/data2/prod
Backup Location
/backup/rman_backup

 Destination details:

Database Name
dup
Hostname
Nsm-stg
Ip Address
172.16.110.16
OS
Linux
Version
x86_64
Datafile Location
/data2/prod
Backup Location
/backup/rman_backup
 
 

 Pre-requisites:
  • Password file from target database.
  • Sqlnet.ora should have correct parameters.
  • Target database should be running through spfile.
 Steps on target (source) server:
  • export ORACLE SID
[oracle@Nsm-prod dbs]$ hostname

Nsm-prod

[oracle@Nsm-prod dbs]$ export ORACLE_SID=prod

  •   Connect to RMAN.


[oracle@Nsm-prod dbs]$ rman target sys/oracle



Recovery Manager: Release 11.2.0.1.0 - Production on Thu Apr 9 10:47:41 2015



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



connected to target database: PROD (DBID=284539893)



RMAN>

  •   Issue the following command to initiate backup. Before issue the backup command verify the backup location.

RMAN> show all;

RMAN configuration parameters for database with db_unique_name PROD are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/rman_backup/controlfile_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/backup/rman_backup/db_arch_%U.bkp';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/data2/app/oracle/product/11.2.0/dbs/snapcf_prod.f'; # default



RMAN> backup database plus archivelog;





Starting backup at 09-APR-15

current log archived

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=22 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=85 RECID=81 STAMP=875052425

input archived log thread=1 sequence=86 RECID=82 STAMP=875086125

input archived log thread=1 sequence=87 RECID=83 STAMP=875118622

input archived log thread=1 sequence=88 RECID=84 STAMP=875138912

input archived log thread=1 sequence=89 RECID=85 STAMP=875169392

input archived log thread=1 sequence=90 RECID=86 STAMP=875202890

input archived log thread=1 sequence=91 RECID=87 STAMP=875225400

input archived log thread=1 sequence=92 RECID=88 STAMP=875253619

input archived log thread=1 sequence=93 RECID=89 STAMP=875287426

input archived log thread=1 sequence=94 RECID=90 STAMP=875311887

input archived log thread=1 sequence=95 RECID=91 STAMP=875338210

input archived log thread=1 sequence=96 RECID=92 STAMP=875371700

input archived log thread=1 sequence=97 RECID=93 STAMP=875398375

input archived log thread=1 sequence=98 RECID=94 STAMP=875422534

input archived log thread=1 sequence=99 RECID=95 STAMP=875455916

input archived log thread=1 sequence=100 RECID=96 STAMP=875489442

input archived log thread=1 sequence=101 RECID=97 STAMP=875511892

input archived log thread=1 sequence=102 RECID=98 STAMP=875532973

input archived log thread=1 sequence=103 RECID=99 STAMP=875566589

input archived log thread=1 sequence=104 RECID=100 STAMP=875598381

input archived log thread=1 sequence=105 RECID=101 STAMP=875617253

input archived log thread=1 sequence=106 RECID=102 STAMP=875650222

input archived log thread=1 sequence=107 RECID=103 STAMP=875683804

input archived log thread=1 sequence=108 RECID=104 STAMP=875692844

input archived log thread=1 sequence=109 RECID=105 STAMP=875726521

input archived log thread=1 sequence=110 RECID=106 STAMP=875759423

input archived log thread=1 sequence=111 RECID=107 STAMP=875771364

input archived log thread=1 sequence=112 RECID=108 STAMP=875804400

input archived log thread=1 sequence=113 RECID=109 STAMP=875809288

input archived log thread=1 sequence=114 RECID=110 STAMP=875842252

input archived log thread=1 sequence=115 RECID=111 STAMP=875857844

input archived log thread=1 sequence=116 RECID=112 STAMP=875883160

input archived log thread=1 sequence=117 RECID=113 STAMP=875939543

input archived log thread=1 sequence=118 RECID=114 STAMP=875955632

input archived log thread=1 sequence=119 RECID=115 STAMP=875960595

input archived log thread=1 sequence=120 RECID=116 STAMP=876018651

input archived log thread=1 sequence=121 RECID=117 STAMP=876036137

input archived log thread=1 sequence=122 RECID=118 STAMP=876094207

input archived log thread=1 sequence=123 RECID=119 STAMP=876117455

input archived log thread=1 sequence=124 RECID=120 STAMP=876173429

input archived log thread=1 sequence=125 RECID=121 STAMP=876203937

input archived log thread=1 sequence=126 RECID=122 STAMP=876259857

input archived log thread=1 sequence=127 RECID=123 STAMP=876288622

input archived log thread=1 sequence=128 RECID=124 STAMP=876308432

input archived log thread=1 sequence=129 RECID=125 STAMP=876364250

input archived log thread=1 sequence=130 RECID=126 STAMP=876378605

input archived log thread=1 sequence=131 RECID=127 STAMP=876398550

input archived log thread=1 sequence=132 RECID=128 STAMP=876399532

input archived log thread=1 sequence=133 RECID=129 STAMP=876419413

input archived log thread=1 sequence=134 RECID=130 STAMP=876421079

input archived log thread=1 sequence=135 RECID=131 STAMP=876461598

input archived log thread=1 sequence=136 RECID=132 STAMP=876504610

input archived log thread=1 sequence=137 RECID=133 STAMP=876548085

input archived log thread=1 sequence=138 RECID=134 STAMP=876567056

input archived log thread=1 sequence=139 RECID=135 STAMP=876567230

input archived log thread=1 sequence=140 RECID=136 STAMP=876583581

channel ORA_DISK_1: starting piece 1 at 09-APR-15

channel ORA_DISK_1: finished piece 1 at 09-APR-15

piece handle=/backup/rman_backup/db_arch_2iq3v6ku_1_1.bkp tag=TAG20150409T152621 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45

Finished backup at 09-APR-15



Starting backup at 09-APR-15

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=/data2/prod/system01.dbf

input datafile file number=00002 name=/data2/prod/sysaux01.dbf

input datafile file number=00005 name=/data2/prod/example01.dbf

input datafile file number=00003 name=/data2/prod/undotbs01.dbf

input datafile file number=00006 name=/data2/prod/data01.dbf

input datafile file number=00004 name=/data2/prod/users01.dbf

input datafile file number=00007 name=/data2/prod/test01.dbf

input datafile file number=00008 name=/data2/prod/tools01.dbf

channel ORA_DISK_1: starting piece 1 at 09-APR-15

channel ORA_DISK_1: finished piece 1 at 09-APR-15

piece handle=/backup/rman_backup/db_arch_2jq3v6o8_1_1.bkp tag=TAG20150409T152807 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05

Finished backup at 09-APR-15



Starting backup at 09-APR-15

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=141 RECID=137 STAMP=876583754

channel ORA_DISK_1: starting piece 1 at 09-APR-15

channel ORA_DISK_1: finished piece 1 at 09-APR-15

piece handle=/backup/rman_backup/db_arch_2kq3v6qa_1_1.bkp tag=TAG20150409T152914 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 09-APR-15



Starting Control File and SPFILE Autobackup at 09-APR-15

piece handle=/backup/rman_backup/controlfile_c-284539893-20150409-01 comment=NONE

Finished Control File and SPFILE Autobackup at 09-APR-15



RMAN>

  •   Create pfile and copy to destination server.

SQL> create pfile='/backup/rman_backup/initprod.ora' from spfile;

File created.



[oracle@Nsm-prod rman_backup]$ scp initprod.ora  oracle@172.16.110.16:/data1/oracle11g/product/dbs/

oracle@172.16.110.16's password:

initprod.ora                                                                                                                                                       100% 1169     1.1KB/s   00:00
  Before start scp/ftp to destination server create directory structure to accommodate rman backup on destination server.



[oracle@Nsm-stg prod]$ mkdir -p /backup/rman_backup/

  • Copy rman backup from target to destination server.

[oracle@Nsm-prod rman_backup]$ scp *.bkp oracle@172.16.110.16:/backup/rman_backup/
oracle@172.16.110.16's password:
db_arch_2iq3v6ku_1_1.bkp                                                                                                                                           100% 1799MB  11.2MB/s   02:40
db_arch_2jq3v6o8_1_1.bkp                                                                                                                                           100% 1133MB  11.2MB/s   01:41
db_arch_2kq3v6qa_1_1.bkp                                                                                                                                           100%   23KB  22.5KB/s   00:00
initprod.ora.bkp                                                                                                                                                   100% 1250     1.2KB/s   00:00
[oracle@Nsm-prod rman_backup]$ scp controlfile_c-284539893-20150409-01 oracle@172.16.110.16:/backup/rman_backup/
oracle@172.16.110.16's password:
controlfile_c-284539893-20150409-01                                                                                                                                100% 9632KB   9.4MB/s   00:01
 
Steps on destination server:
  • Create directory structure same as target(source) database.

[oracle@Nsm-stg prod]$ mkdir -p /data2/prod
[oracle@Nsm-stg prod]$ mkdir -p /backup/archive/

  •   Start the new instance in nomount.

[oracle@Nsm-stg rman_backup]$ export ORACLE_SID=dup
[oracle@Nsm-stg dbs]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 9 12:14:35 2015

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

Enter user-name: sys as sysdba
Enter password:
Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1152450560 bytes
Fixed Size                  2212696 bytes
Variable Size             352324776 bytes
Database Buffers          788529152 bytes
Redo Buffers                9383936 bytes
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

  •   Connect to rman.

[oracle@Nsm-stg dbs]$ rman auxiliary sys/oracle

Recovery Manager: Release 11.2.0.1.0 - Production on Thu Apr 9 15:59:57 2015

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

connected to auxiliary database: DUP (not mounted)

RMAN>
  Issue the following command to duplicate database with different name and same directory structure.


RMAN> duplicate database to dup backup location '/backup/rman_backup' nofilenamecheck;

Starting Duplicate Db at 09-APR-15

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    1152450560 bytes

Fixed Size                     2212696 bytes
Variable Size                335547560 bytes
Database Buffers             805306368 bytes
Redo Buffers                   9383936 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''PROD'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''DUP'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile from  '/backup/rman_backup/controlfile_c-284539893-20150409-01';
   alter clone database mount;
}
executing Memory Script

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area    1152450560 bytes

Fixed Size                     2212696 bytes
Variable Size                335547560 bytes
Database Buffers             805306368 bytes
Redo Buffers                   9383936 bytes

Starting restore at 09-APR-15
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=63 device type=DISK

channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/data2/prod/control01.ctl
output file name=/data2/prod/control02.ctl
Finished restore at 09-APR-15

database mounted
released channel: ORA_AUX_DISK_1
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=63 device type=DISK

contents of Memory Script:
{
   set until scn  4970799;
   set newname for datafile  1 to
 "/data2/prod/system01.dbf";
   set newname for datafile  2 to
 "/data2/prod/sysaux01.dbf";
   set newname for datafile  3 to
 "/data2/prod/undotbs01.dbf";
   set newname for datafile  4 to
 "/data2/prod/users01.dbf";
   set newname for datafile  5 to
 "/data2/prod/example01.dbf";
   set newname for datafile  6 to
 "/data2/prod/data01.dbf";
   set newname for datafile  7 to
 "/data2/prod/test01.dbf";
   set newname for datafile  8 to
 "/data2/prod/tools01.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

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 09-APR-15
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 /data2/prod/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /data2/prod/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /data2/prod/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /data2/prod/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /data2/prod/example01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /data2/prod/data01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /data2/prod/test01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /data2/prod/tools01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /backup/rman_backup/db_arch_2jq3v6o8_1_1.bkp
channel ORA_AUX_DISK_1: piece handle=/backup/rman_backup/db_arch_2jq3v6o8_1_1.bkp tag=TAG20150409T152807
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 09-APR-15

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

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=876585776 file name=/data2/prod/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=876585777 file name=/data2/prod/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=876585777 file name=/data2/prod/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=876585777 file name=/data2/prod/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=876585778 file name=/data2/prod/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=6 STAMP=876585778 file name=/data2/prod/data01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=7 STAMP=876585778 file name=/data2/prod/test01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=8 STAMP=876585779 file name=/data2/prod/tools01.dbf

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

executing command: SET until clause

Starting recover at 09-APR-15
using channel ORA_AUX_DISK_1
datafile 6 not processed because file is read-only
datafile 8 not processed because file is read-only

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=141
channel ORA_AUX_DISK_1: reading from backup piece /backup/rman_backup/db_arch_2kq3v6qa_1_1.bkp
channel ORA_AUX_DISK_1: piece handle=/backup/rman_backup/db_arch_2kq3v6qa_1_1.bkp tag=TAG20150409T152914
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/backup/archive/1_141_872701561.dbf thread=1 sequence=141
channel clone_default: deleting archived log(s)
archived log file name=/backup/archive/1_141_872701561.dbf RECID=1 STAMP=876585786
media recovery complete, elapsed time: 00:00:04
Finished recover at 09-APR-15

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
 ''DUP'' 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    1152450560 bytes

Fixed Size                     2212696 bytes
Variable Size                335547560 bytes
Database Buffers             805306368 bytes
Redo Buffers                   9383936 bytes

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

Fixed Size                     2212696 bytes
Variable Size                335547560 bytes
Database Buffers             805306368 bytes
Redo Buffers                   9383936 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/data2/prod/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/data2/prod/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/data2/prod/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
  '/data2/prod/system01.dbf'
 CHARACTER SET WE8MSWIN1252


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/data2/prod/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/data2/prod/sysaux01.dbf",
 "/data2/prod/undotbs01.dbf",
 "/data2/prod/users01.dbf",
 "/data2/prod/example01.dbf",
 "/data2/prod/test01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /data2/prod/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/data2/prod/sysaux01.dbf RECID=1 STAMP=876585810
cataloged datafile copy
datafile copy file name=/data2/prod/undotbs01.dbf RECID=2 STAMP=876585810
cataloged datafile copy
datafile copy file name=/data2/prod/users01.dbf RECID=3 STAMP=876585811
cataloged datafile copy
datafile copy file name=/data2/prod/example01.dbf RECID=4 STAMP=876585811
cataloged datafile copy
datafile copy file name=/data2/prod/test01.dbf RECID=5 STAMP=876585812

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=876585810 file name=/data2/prod/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=876585810 file name=/data2/prod/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=876585811 file name=/data2/prod/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=876585811 file name=/data2/prod/example01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=5 STAMP=876585812 file name=/data2/prod/test01.dbf

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

database opened

contents of Memory Script:
{
   catalog clone datafilecopy  "/data2/prod/data01.dbf",
 "/data2/prod/tools01.dbf";
   switch clone datafile  6 to datafilecopy
 "/data2/prod/data01.dbf";
   switch clone datafile  8 to datafilecopy
 "/data2/prod/tools01.dbf";
   #online the readonly tablespace
   sql clone "alter tablespace  TOOLS online";
   #online the readonly tablespace
   sql clone "alter tablespace  DATA online";
}
executing Memory Script

cataloged datafile copy
datafile copy file name=/data2/prod/data01.dbf RECID=6 STAMP=876585838
cataloged datafile copy
datafile copy file name=/data2/prod/tools01.dbf RECID=7 STAMP=876585839

datafile 6 switched to datafile copy
input datafile copy RECID=6 STAMP=876585838 file name=/data2/prod/data01.dbf

datafile 8 switched to datafile copy
input datafile copy RECID=7 STAMP=876585839 file name=/data2/prod/tools01.dbf

sql statement: alter tablespace  TOOLS online

sql statement: alter tablespace  DATA online
Finished Duplicate Db at 09-APR-15
 
 Observation:
One strange thing we have found, in this scenario at target side two of the tablespaces are in read only mode, we have taken rman full backup and when trying to duplicate the database it was successful but when check the rman log  it is showing that so and so datafile is not processed because it is in read only mode as follows


Starting recover at 09-APR-15

using channel ORA_AUX_DISK_1

datafile 6 not processed because file is read-only

datafile 8 not processed because file is read-only



starting media recovery



and after some execution it is trying to make those tablespaces online and this is also successful



contents of Memory Script:

{

   catalog clone datafilecopy  "/data2/prod/data01.dbf",

 "/data2/prod/tools01.dbf";

   switch clone datafile  6 to datafilecopy

 "/data2/prod/data01.dbf";

   switch clone datafile  8 to datafilecopy

 "/data2/prod/tools01.dbf";

   #online the readonly tablespace

   sql clone "alter tablespace  TOOLS online";

   #online the readonly tablespace

   sql clone "alter tablespace  DATA online";

}

  In Alert log file it is showing, bringing up the tablespaces online.


Switch of datafile 6 complete to datafile copy
  checkpoint is 4866414
Switch of datafile 8 complete to datafile copy
  checkpoint is 4866426
alter tablespace  TOOLS online
Completed: alter tablespace  TOOLS online
alter tablespace  DATA online
Completed: alter tablespace  DATA online
Thu Apr 09 16:04:05 2015
  Then replication has successful then i have cross checked in database and those tablespaces are there with Read only access.


SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
DUP       READ WRITE

SQL> select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
TEMP                           ONLINE
USERS                          ONLINE
EXAMPLE                        ONLINE
DATA                           READ ONLY
TEST                           ONLINE
TOOLS                          READ ONLY

9 rows selected.
  As per my understanding the tablespace bringing online is different thing, whereas status is different thing whenever we start up the database, it will bring up all the tablespaces online, to change tablespace mode we need to execute the command as follows.


SQL> alter tablespace DATA  Read write;

Tablespace altered.

SQL> alter tablespace TOOLS  Read write;

Tablespace altered.


SQL> select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
TEMP                           ONLINE
USERS                          ONLINE
EXAMPLE                        ONLINE
DATA                           ONLINE
TEST                           ONLINE
TOOLS                          ONLINE

9 rows selected.
 

Conclusion
In the preceding scenario based article, we have learned that backup based duplication using Rman utility with different database name and same directory structure,
with Read only tablespace, if we have tablespaces are in read only mode same thing would replicate at target side.

BY
Name: Omer
Designation: Senior Database Engineer
Organization: Netsoftmate IT Solutions.

No comments:

Post a Comment

Comparing Oracle Database Appliance X8-2 Model Family

September 2019 Oracle announced Oracle Database Appliance X8-2 (Small, Medium and HA). ODA X8-2 comes with more computing resources com...