Thursday, December 29, 2011

Cloning oracle Using RMAN in windows




1.CREATE PASSWORD FILE FOR DUPLICATE DATABSE IN PRODUCTION DATABASE

--    ORAPWD FILE=C:\PWDDUP.ORA PASSWORD=ORACLE

2.CREATE INTI.ORA  FROM CURRENT INSTANACE OF PRODUCTION DATABASE;

---   CREATE PFILE FROM SPFILE ;

    
3.MODIFY NECESSARY PARAMETERS AND LOCATTIONS IN INTIT.ORA FILE FOR DUPLICATE DATABASE

set     db_file_name_convert=(,)
        log_file_name_convert=(,)
    
       RMAN-05001: auxiliary filename '%s' conflicts with a file used by the target database

4.COPY BOTH PWD , INIT FILE TO TARGET SYSTEM

5.CREATE SERVICES FOR DUPICATE DATABASE

---  oradim -NEW -SID dup -SRVC oracleservicedup -STARTMODE auto -SRVCSTART system

6.FOR DUPICATE DATASE CREATE SPFIE FROM PFILE WHICH WE MODIFIED RECENTLY

--CREATE SPFILE FROM PFILE;

7.CREATE NECESSARY FOLDERS ON DUPLICATE DATABASE  SYSTEM

8.CREATE BACKUP AS COPY USING RMAN

  ---  BACKUP AS COPY DATABASE ARCHIVELOG ALL;

9.COPY ALL RMAN BACKUPS TO DESTINATION SYSTEM WITH SAME DIRECTORY STRUCTURE

   RMAN-06023: no backup or copy of datafile 5 found to restore

10.NOW CREATE DUPLICATE DATABASE USING RMAN DUPLICAE DATABASE COMMAND

run {
 ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
 DUPLICATE TARGET DATABASE TO dup;
 }



-----------------------------------------------------------------------------


RMAN> run{
allocate auxiliary channel aux device type disk;
duplicate target database to dup;
 }

released channel: ORA_DISK_1
allocated channel: aux
channel aux: sid=323 devtype=DISK

Starting Duplicate Db at 03-MAR-11

contents of Memory Script:
{
   set until scn  5268820;
   set newname for datafile  1 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSTEM01.DBF";
   set newname for datafile  2 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF";
   set newname for datafile  3 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF";
   set newname for datafile  4 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF";
   set newname for datafile  5 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.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

Starting restore at 03-MAR-11

channel aux: restoring datafile 00001
input datafile copy recid=8 stamp=744758063 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_SYSTEM_6PWSFSMK_.DBF
destination for restore of datafile 00001: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSTEM01.DBF
ORA-19505: failed to identify file "F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_SYSTEM_6PWSFSMK_.DBF"
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
ORA-19600: input file is datafile-copy 0 (F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_SYSTEM_6PWSFSMK_.DBF)
ORA-19601: output file is datafile 1 (G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSTEM01.DBF
channel aux: restoring datafile 00002
input datafile copy recid=10 stamp=744758106 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_UNDOTBS1_6PWSHP7B_.DBF
destination for restore of datafile 00002: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF
ORA-19505: failed to identify file "F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_UNDOTBS1_6PWSHP7B_.DBF"
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
ORA-19600: input file is datafile-copy 0 (F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_UNDOTBS1_6PWSHP7B_.DBF
channel aux: restoring datafile 00003
input datafile copy recid=9 stamp=744758089 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_SYSAUX_6PWSGWWB_.DBF
destination for restore of datafile 00003: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF
ORA-19505: failed to identify file "F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_SYSAUX_6PWSGWWB_.DBF"
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
ORA-19600: input file is datafile-copy 0 (F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_SYSAUX_6PWSGWWB_.DBF)
ORA-19601: output file is datafile 3 (G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF
channel aux: restoring datafile 00004
input datafile copy recid=7 stamp=744758028 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_6PWSD2B8_.DBF
destination for restore of datafile 00004: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF
ORA-19505: failed to identify file "F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_6PWSD2B8_.DBF"
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
ORA-19600: input file is datafile-copy 0 (F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_6PWSD2B8_.DBF)
ORA-19601: output file is datafile 4 (G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF
channel aux: restoring datafile 00005
input datafile copy recid=11 stamp=744758114 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_EXAMPLE_6PWSJ5H4_.DBF
destination for restore of datafile 00005: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.DBF
ORA-19505: failed to identify file "F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_EXAMPLE_6PWSJ5H4_.DBF"
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
ORA-19600: input file is datafile-copy 0 (F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_EXAMPLE_6PWSJ5H4_.DBF)
ORA-19601: output file is datafile 5 (G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.DBF
failover to previous backup

released channel: aux
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/03/2011 07:44:59
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore


#####################################################################
### I HAVEN'T COPIED THE RMAN BACKUP TO DESTINATION SYSTEM
### SO I GOT ABOVE ERROR. I COPIED BACKUP  TO DESTINATION SYSTEM AND TRYIED AGAIN
#####################################################################


RMAN> run{
2> allocate auxiliary channel aux device type disk;
3> duplicate target database to dup;
4> }

allocated channel: aux
channel aux: sid=323 devtype=DISK

Starting Duplicate Db at 03-MAR-11

contents of Memory Script:
{
   set until scn  5268820;
   set newname for datafile  1 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSTEM01.DBF";
   set newname for datafile  2 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF";
   set newname for datafile  3 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF";
   set newname for datafile  4 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF";
   set newname for datafile  5 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.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

Starting restore at 03-MAR-11

channel aux: restoring datafile 00001
input datafile copy recid=8 stamp=744758063 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_SYSTEM_6PWSFSMK_.DBF
destination for restore of datafile 00001: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSTEM01.DBF
channel aux: copied datafile copy of datafile 00001
output filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSTEM01.DBF
channel aux: restoring datafile 00002
input datafile copy recid=10 stamp=744758106 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_UNDOTBS1_6PWSHP7B_.DBF
destination for restore of datafile 00002: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF
channel aux: copied datafile copy of datafile 00002
output filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF
channel aux: restoring datafile 00003
input datafile copy recid=9 stamp=744758089 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_SYSAUX_6PWSGWWB_.DBF
destination for restore of datafile 00003: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF
channel aux: copied datafile copy of datafile 00003
output filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF
channel aux: restoring datafile 00004
input datafile copy recid=7 stamp=744758028 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_6PWSD2B8_.DBF
destination for restore of datafile 00004: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF
channel aux: copied datafile copy of datafile 00004
output filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF
channel aux: restoring datafile 00005
input datafile copy recid=11 stamp=744758114 filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_EXAMPLE_6PWSJ5H4_.DBF
destination for restore of datafile 00005: G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.DBF
channel aux: copied datafile copy of datafile 00005
output filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.DBF
Finished restore at 03-MAR-11
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\REDO01.LOG' ) SIZE 50 M  REUSE,
  GROUP  2 ( 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\REDO02.LOG' ) SIZE 50 M  REUSE,
  GROUP  3 ( 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\REDO03.LOG' ) SIZE 50 M  REUSE
 DATAFILE
  'G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSTEM01.DBF'
 CHARACTER SET WE8MSWIN1252


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

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=744798237 filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=744798237 filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=744798237 filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=744798237 filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.DBF

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

executing command: SET until clause

Starting recover at 03-MAR-11

starting media recovery

archive log thread 1 sequence 255 is already on disk as file F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2011_03_03\O1_MF_1_255_6PXY914D_.ARC
archive log thread 1 sequence 256 is already on disk as file F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2011_03_03\O1_MF_1_256_6PXY99M1_.ARC
archive log thread 1 sequence 257 is already on disk as file F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2011_03_03\O1_MF_1_257_6PXY95C7_.ARC
archive log filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2011_03_03\O1_MF_1_255_6PXY914D_.ARC thread=1 sequence=255
archive log filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2011_03_03\O1_MF_1_256_6PXY99M1_.ARC thread=1 sequence=256
archive log filename=F:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2011_03_03\O1_MF_1_257_6PXY95C7_.ARC thread=1 sequence=257
media recovery complete, elapsed time: 00:00:20
Finished recover at 03-MAR-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     314572800 bytes

Fixed Size                     1248744 bytes
Variable Size                 96469528 bytes
Database Buffers             213909504 bytes
Redo Buffers                   2945024 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\REDO01.LOG' ) SIZE 50 M  REUSE,
  GROUP  2 ( 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\REDO02.LOG' ) SIZE 50 M  REUSE,
  GROUP  3 ( 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\REDO03.LOG' ) SIZE 50 M  REUSE
 DATAFILE
  'G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSTEM01.DBF'
 CHARACTER SET WE8MSWIN1252


contents of Memory Script:
{
   set newname for tempfile  1 to
 "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\TEMP01.DBF";
   switch clone tempfile all;
   catalog clone datafilecopy  "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF";
   catalog clone datafilecopy  "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF";
   catalog clone datafilecopy  "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF";
   catalog clone datafilecopy  "G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.DBF";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

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

cataloged datafile copy
datafile copy filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF recid=1 stamp=744798804

cataloged datafile copy
datafile copy filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF recid=2 stamp=744798805

cataloged datafile copy
datafile copy filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF recid=3 stamp=744798807

cataloged datafile copy
datafile copy filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.DBF recid=4 stamp=744798808

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=744798804 filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=744798805 filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\SYSAUX01.DBF
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=744798807 filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=744798808 filename=G:\ORACLE\PRODUCT\10.2.0\ORADATA\DUP\EXAMPLE01.DBF

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

database opened
Finished Duplicate Db at 03-MAR-11

RMAN>







No comments: