Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Sunday, February 27, 2011

Create Duplicate DB with RMAN - Single Instance

You can use the RMAN DUPLICATE command to create a duplicate database from target database backups while still retaining the original target database. The duplicate database can be either identical to the original database or contain only a subset of the original tablespaces.


To prepare for database duplication, you must first create an auxiliary instance. For the duplication to work, you must connect RMAN to both the target (primary) database and an auxiliary instance started in NOMOUNT mode.

You must have at least one auxiliary channel allocated on the auxiliary instance. The principal work of the duplication is performed by the auxiliary channel, which starts a server session on the auxiliary host. This channel then restores the necessary backups of the primary database, uses them to create the duplicate database, and initiates recovery.
As part of the duplicating operation, RMAN manages the following:

Restores the target datafiles to the duplicate database and performs incomplete recovery by using all available incremental backups and archived logs.
Shuts down and starts the auxiliary database.
Opens the duplicate database with the RESETLOGS option after incomplete recovery to create the online redo logs.
Generates a new, unique DBID for the auxiliary database.
During duplication, RMAN must perform incomplete recovery because the online redo logs in the target are not backed up and cannot be applied to the auxiliary database. The farest that RMAN can go in recovery of the duplicate database isthe most recent redo log archived by the target database.

Steps
i) C:\Documents and Settings\inam>set ORACLE_SID=DUPDB
ii) create password file
C:\Documents and Settings\inam>orapwd file=pwdDUPDB.ora password=dupdb entries=5
iii) C:\Documents and Settings\inam>oradim -new -sid DUPDB -syspwd dupdb
Instance created.
iv) C:\Documents and Settings\inam>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 23 13:51:02 2011

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

Connected to an idle instance.
v) change in listener.ora and tnsnames.ora to conncect via tnsnames
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = DUPDB)
(ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
)
(SID_DESC =
(SID_NAME = HOMEQA)
(ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = or1.domian)(PORT = 1521))
)
)

tnsnames.ora

DUPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = or1.domain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DUPDB)
)

vi) create parameter file for duplicate database as target , in our case HOMEQA
initDUPDB.ora
##############################################################################

# Copyright (c) 1991, 2001, 2002 by Oracle Corporation

##############################################################################

###########################################

# Cache and I/O

###########################################

db_block_size=8192

db_file_multiblock_read_count=16

###########################################

# Cursors and Library Cache

###########################################

open_cursors=300

###########################################

# Database Identification

###########################################

db_domain=""

db_name=DUPDB

###########################################

# Diagnostics and Statistics

###########################################

background_dump_dest=E:\oracle\product\10.2.0/admin/DUPDB/bdump

core_dump_dest=E:\oracle\product\10.2.0/admin/DUPDB/cdump

user_dump_dest=E:\oracle\product\10.2.0/admin/DUPDB/udump

###########################################

# File Configuration

###########################################

control_files=("E:\oracle\product\10.2.0/oradata/DUPDB/\control01.ctl", "E:\oracle\product\10.2.0/oradata/DUPDB/\control02.ctl", "E:\oracle\product\10.2.0/oradata/DUPDB/\control03.ctl")

db_recovery_file_dest=E:\oracle\product\10.2.0/flash_recovery_area

db_recovery_file_dest_size=2147483648

log_archive_dest_10='LOCATION=E:\oracle\product\10.2.0\oradata\logarchive'

#log_archive_dest=E:\oracle\product\10.2.0\oradata\logarchive

###########################################

# Job Queues

###########################################

job_queue_processes=10

###########################################

# Miscellaneous

###########################################

compatible=10.2.0.1.0

###########################################

# Processes and Sessions

###########################################

processes=150

###########################################

# SGA Memory

###########################################

sga_target=612368384

###########################################

# Security and Auditing

###########################################

audit_file_dest=E:\oracle\product\10.2.0/admin/DUPDB/adump

remote_login_passwordfile=EXCLUSIVE

###########################################

# Shared Server

###########################################

#dispatchers="(PROTOCOL=TCP) (SERVICE=HOMEDUPDBDB)"

###########################################

# Sort, Hash Joins, Bitmap Indexes

###########################################

pga_aggregate_target=203423744

###########################################

# System Managed Undo and Rollback Segments

###########################################

undo_management=AUTO

undo_tablespace=UNDOTBS1


vii) startup the instance by init.ora
SQL> startup force nomount pfile=E:\oracle\product\10.2.0\admin\DUPDB\initDUPDB.ora

ORACLE instance started.

Total System Global Area 612368384 bytes
Fixed Size 1250452 bytes
Variable Size 167775084 bytes
Database Buffers 440401920 bytes
Redo Buffers 2940928 bytes
SQL>

Viii) create spfile for the duplicate database
SQL> create spfile from pfile='E:\oracle\product\10.2.0\admin\DUPDB\initDUPDB.ora';

File created.

SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 612368384 bytes
Fixed Size 1250452 bytes
Variable Size 167775084 bytes
Database Buffers 440401920 bytes
Redo Buffers 2940928 bytes
SQL>

ix) Run the rman script for duplication
C:\Documents and Settings\inam>rman

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Feb 27 12:40:37 2011

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

RMAN> connect target system/homeqa@homeqa;

connected to target database: HOMEQA (DBID=277369372)

RMAN> connect auxiliary sys/dupdb@dupdb;

connected to auxiliary database: DUPDB (not mounted)

RUN{
set until time "to_date('Feb 23 2011 15:30:00','Mon DD YYYY HH24:MI:SS')";
SET NEWNAME FOR DATAFILE 1 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSTEM01.DBF';
SET NEWNAME FOR DATAFILE 2 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\UNDOTBS01.DBF';
SET NEWNAME FOR DATAFILE 3 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSAUX01.DBF';
SET NEWNAME FOR DATAFILE 4 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\USERS01.DBF';
SET NEWNAME FOR DATAFILE 5 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME01.DBF';
SET NEWNAME FOR DATAFILE 6 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\
HOME02.DBF';
SET NEWNAME FOR DATAFILE 7 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\
HOME03.DBF';
SET NEWNAME FOR DATAFILE 8 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\
HOMELOG01.DBF';
SET NEWNAME FOR DATAFILE 9 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\
HOMELOG02.DBF';
SET NEWNAME FOR DATAFILE 10 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEST_NETBKUP.DBF';
SET NEWNAME FOR TEMPFILE 1 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEMP01.DBF';
DUPLICATE TARGET DATABASE TO DUPDB
LOGFILE
GROUP 1 ('E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO01.LOG') SIZE 50M REUSE,
GROUP 2 ('E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO02.LOG') SIZE 50M REUSE,
GROUP 3 ('E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO03.LOG') SIZE 50M REUSE;
}
x) Observe the output and make necessary correction if any error and run rman script again if required.
C:\Documents and Settings\inam>rman


Recovery Manager: Release 10.2.0.1.0 - Production on Sun Feb 27 12:40:37 2011


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


RMAN> connect target system/homeqa@homeqa;


connected to target database: HOMEQA (DBID=277369372)


RMAN> connect auxiliary sys/dupdb@dupdb;


connected to auxiliary database: DUPDB (not mounted)


RMAN> RUN{
2>     set until time "to_date('Feb 23 2011 15:30:00','Mon DD YYYY HH24:MI:SS')";
3>     SET NEWNAME FOR DATAFILE 1 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSTEM01.DBF';
4>     SET NEWNAME FOR DATAFILE 2 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\UNDOTBS01.DBF';
5>     SET NEWNAME FOR DATAFILE 3 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSAUX01.DBF';
6>     SET NEWNAME FOR DATAFILE 4 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\USERS01.DBF';
7>     SET NEWNAME FOR DATAFILE 5 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME01.DBF';
8>     SET NEWNAME FOR DATAFILE 6 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME02.DBF';
9>     SET NEWNAME FOR DATAFILE 7 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME03.DBF';
10>     SET NEWNAME FOR DATAFILE 8 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG01.DBF';
11>     SET NEWNAME FOR DATAFILE 9 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG02.DBF';
12>     SET NEWNAME FOR DATAFILE 10 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEST_NETBKUP.DBF';
13>     SET NEWNAME FOR TEMPFILE 1 TO 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEMP01.DBF';
14>     DUPLICATE TARGET DATABASE TO DUPDB
15>     LOGFILE
16>     GROUP 1 ('E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO01.LOG') SIZE 50M REUSE,
17>     GROUP 2 ('E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO02.LOG') SIZE 50M REUSE,
18>     GROUP 3 ('E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO03.LOG') SIZE 50M REUSE;
19> }


executing command: SET until clause
using target database control file instead of recovery catalog

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 Duplicate Db at 27-FEB-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: sid=154 devtype=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: sid=153 devtype=DISK


contents of Memory Script:
{
   set until scn  456075018;
   set newname for datafile  1 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSTEM01.DBF";
   set newname for datafile  2 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\UNDOTBS01.DBF";
   set newname for datafile  3 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSAUX01.DBF";
   set newname for datafile  4 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\USERS01.DBF";
   set newname for datafile  5 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME01.DBF";
   set newname for datafile  6 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME02.DBF";
   set newname for datafile  7 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME03.DBF";
   set newname for datafile  8 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG01.DBF";
   set newname for datafile  9 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG02.DBF";
   set newname for datafile  10 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEST_NETBKUP.DBF";
   restore
   check readonly
   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

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 27-FEB-11
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3


channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSTEM01.DBF
restoring datafile 00002 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\UNDOTBS01.DBF
restoring datafile 00003 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSAUX01.DBF
restoring datafile 00004 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\USERS01.DBF
restoring datafile 00005 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME01.DBF
restoring datafile 00006 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME02.DBF
restoring datafile 00007 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME03.DBF
restoring datafile 00008 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG01.DBF
restoring datafile 00009 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG02.DBF
restoring datafile 00010 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEST_NETBKUP.DBF
channel ORA_AUX_DISK_1: reading from backup piece E:\ORACLE\PRODUCT\10.2.0\ORADATA\RMAN\02M5D5NJ_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=E:\ORACLE\PRODUCT\10.2.0\ORADATA\RMAN\02M5D5NJ_1_1 tag=TAG20110223T151043
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:45
Finished restore at 27-FEB-11
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY     2920
 LOGFILE
  GROUP  1 ( 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO01.LOG' ) SIZE 50 M  REUSE,
  GROUP  2 ( 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO02.LOG' ) SIZE 50 M  REUSE,
  GROUP  3 ( 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO03.LOG' ) SIZE 50 M  REUSE
 DATAFILE
  'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSTEM01.DBF'
 CHARACTER SET AR8ISO8859P6




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


released channel: ORA_AUX_DISK_1
released channel: ORA_AUX_DISK_2
released channel: ORA_AUX_DISK_3
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSAUX01.DBF
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME01.DBF
datafile 6 switched to datafile copy
input datafile copy recid=5 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME02.DBF
datafile 7 switched to datafile copy
input datafile copy recid=6 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME03.DBF
datafile 8 switched to datafile copy
input datafile copy recid=7 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG01.DBF
datafile 9 switched to datafile copy
input datafile copy recid=8 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG02.DBF
datafile 10 switched to datafile copy
input datafile copy recid=9 stamp=744209127 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEST_NETBKUP.DBF


contents of Memory Script:
{
   set until time  "to_date('Feb 23 2011 15:30:00','Mon DD YYYY HH24:MI:SS')";
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script


executing command: SET until clause


Starting recover at 27-FEB-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=153 devtype=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: sid=154 devtype=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: sid=155 devtype=DISK


starting media recovery


channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_2: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=386
channel ORA_AUX_DISK_1: reading from backup piece E:\ORACLE\PRODUCT\10.2.0\ORADATA\RMAN\04M5D5V4_1_1
channel ORA_AUX_DISK_2: restoring archive log
archive log thread=1 sequence=387
channel ORA_AUX_DISK_2: reading from backup piece E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\HOMEQA\BACKUPSET\2011_02_
23\O1_MF_ANNNN_HOMEQA_BKP_6P9ZHH7W_.BKP
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=E:\ORACLE\PRODUCT\10.2.0\ORADATA\RMAN\04M5D5V4_1_1 tag=HOMEQA_BKP
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archive log filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\LOGARCHIVE\ARC00386_0743681246.001 thread=1 sequence=386
channel clone_default: deleting archive log(s)
archive log filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\LOGARCHIVE\ARC00386_0743681246.001 recid=1 stamp=744209148
channel ORA_AUX_DISK_2: restored backup piece 1
piece handle=E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\HOMEQA\BACKUPSET\2011_02_23\O1_MF_ANNNN_HOMEQA_BKP_6P9ZHH7W_.B
KP tag=HOMEQA_BKP
channel ORA_AUX_DISK_2: restore complete, elapsed time: 00:00:01
archive log filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\LOGARCHIVE\ARC00387_0743681246.001 thread=1 sequence=387
channel clone_default: deleting archive log(s)
archive log filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\LOGARCHIVE\ARC00387_0743681246.001 recid=2 stamp=744209148
media recovery complete, elapsed time: 00:00:01
Finished recover at 27-FEB-11


contents of Memory Script:
{
   shutdown clone;
   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     612368384 bytes


Fixed Size                     1250452 bytes
Variable Size                167775084 bytes
Database Buffers             440401920 bytes
Redo Buffers                   2940928 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY     2920
 LOGFILE
  GROUP  1 ( 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO01.LOG' ) SIZE 50 M  REUSE,
  GROUP  2 ( 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO02.LOG' ) SIZE 50 M  REUSE,
  GROUP  3 ( 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\REDO03.LOG' ) SIZE 50 M  REUSE
 DATAFILE
  'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSTEM01.DBF'
 CHARACTER SET AR8ISO8859P6




contents of Memory Script:
{
   set newname for tempfile  1 to
 "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEMP01.DBF";
   switch clone tempfile all;
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\UNDOTBS01.DBF";
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSAUX01.DBF";
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\USERS01.DBF";
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME01.DBF";
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME02.DBF";
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME03.DBF";
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG01.DBF";
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG02.DBF";
   catalog clone datafilecopy  "E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEST_NETBKUP.DBF";
   switch clone datafile all;
}
executing Memory Script


executing command: SET NEWNAME


renamed temporary file 1 to E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEMP01.DBF in control file


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\UNDOTBS01.DBF recid=1 stamp=744212333


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSAUX01.DBF recid=2 stamp=744212336


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\USERS01.DBF recid=3 stamp=744212338


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME01.DBF recid=4 stamp=744212341


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME02.DBF recid=5 stamp=744212343


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME03.DBF recid=6 stamp=744212345


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG01.DBF recid=7 stamp=744212348


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG02.DBF recid=8 stamp=744212349


cataloged datafile copy
datafile copy filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEST_NETBKUP.DBF recid=9 stamp=744212352


datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=744212333 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=744212336 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\SYSAUX01.DBF
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=744212338 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=744212341 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME01.DBF
datafile 6 switched to datafile copy
input datafile copy recid=5 stamp=744212343 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME02.DBF
datafile 7 switched to datafile copy
input datafile copy recid=6 stamp=744212345 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOME03.DBF
datafile 8 switched to datafile copy
input datafile copy recid=7 stamp=744212348 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG01.DBF
datafile 9 switched to datafile copy
input datafile copy recid=8 stamp=744212349 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\HOMELOG02.DBF
datafile 10 switched to datafile copy
input datafile copy recid=9 stamp=744212352 filename=E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPDB\TEST_NETBKUP.DBF


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


database opened
Finished Duplicate Db at 27-FEB-11


RMAN>


Considerations:
1- Target DB must be in archivelog mode
2- read/write privs on the OS, paths on the OS, other wise may encounter the error like below.
RMAN-06136: ORACLE error from auxiliary database: ORA-01264: Unable to create logfile file name
3- think set until time clause in the script, wrong format or wrong time for which you don't have backup may cause the error like below.
RMAN-03002: failure of Duplicate Db command at 02/23/2011 14:52:24
ORA-01405: fetched column value is NULL
In the above case try "ALTER SYSTEM SWITCH LOGFILE"
4- If you get the below error
RMAN-06023: no backup or copy of datafile 9 found to restore
then "set until time" may be wrong or you don't have the backup.
5- If you get the error below
ORA-16032: parameter LOG_ARCHIVE_DEST_10 destination string cannot be translated
then set the parameter (spfile or init)
LOG_ARCHIVE_DEST_10= LOCATION=E:\oracle\product\10.2.0\oradata\logarchive_10
6- On windows I've observed that you can't create the folder as "AUX", so don't create the instance with such name because at rman will try to create the folder at run time in the flash recovery area and will be failed. Althogh intance is created with this name.


Ref:
228257.1

No comments: