Solved

duplicate database

Posted on 2010-11-30
3
445 Views
Last Modified: 2012-05-10
How can I duplicate oracle database on unix system. I really appreciate your help.
0
Comment
Question by:hussainkhan22
3 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34239510
Haven't you already asked this question before?

http://www.experts-exchange.com/Database/Oracle/Q_26579204.html

The answer is the same:  Best way: RMAN clone.
0
 
LVL 6

Accepted Solution

by:
sridharv9 earned 250 total points
ID: 34240798
0
 
LVL 5

Assisted Solution

by:manzoor_dba
manzoor_dba earned 250 total points
ID: 34247617
Hi,

You can dupliacte (clone) a database using three methods.

They are using ( COLD BACKUP, HOT BACKUP & USING RMAN).

Below are the details examples on how to clone a database.

Hot Backup Cloning:-

Target dbname = tomig
clone dbname = clntomig


1. Take the hot backup of target database, and backup of controlfile trace and pfile.

2. Create the directory structure for the clone database.

3. Copy the backups to the clone db and place the files to the appropirate directories.

i.e. Place the db files under oradata/clntomig folder and pfile to the
admin/clntomig/pfile directory.

4. Modify the clone db pfile parameters accordingly.

1. File location of trace files, dump file, controlfiles.
2. db_name = clntomig

IF you are doing the cloning on the same server then add the below parameters, else if your cloning on a different server with the same directory structure then the below parameters are not required.

1. db_file_name_convert = '/u01/app/oracle/oradata/tomig','/u01/app/oracle/oradata/clntomig'
2. log_file_name_convert = '/u01/app/oracle/oradata/tomig','/u01/app/oracle/oradata/clntomig'


5. Create the password file for the clone db.

unix :- $ orapwd file=$ORACLE_HOME/dbs/orapwclntomig password=sys entries=10

Windows :- > orapwd file=E:\oracle\product\10.2.0\db_1\database\PWDclntomig.ora entries=10

6. Create a New instance if the OS is windows.

>oradim -new -sid clntomig

7. Modify the Controlfile trace as below and save it as an sql script file. (controlrecreate.sql)

CREATE CONTROLFILE SET DATABASE "CLNTOMIG" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'/u01/app/oracle/oradata/clntomig/redo01.rdo',
'/u01/app/oracle/oradata/clntomig/redo02.rdo'
) SIZE 20M,
GROUP 2 (
'/u01/app/oracle/oradata/clntomig/redo03.rdo',
'/u01/app/oracle/oradata/clntomig/redo04.rdo'
) SIZE 20M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/clntomig/system01.dbf',
'/u01/app/oracle/oradata/clntomig/undo01.dbf',
'/u01/app/oracle/oradata/clntomig/sysaux01.dbf',
'/u01/app/oracle/oradata/clntomig/users01.dbf'
CHARACTER SET US7ASCII
/


8. Perfrom the following steps.


$ export ORACLE_SID=stdtomig
$ sqlplus / as sysdba


SQL> create spfile from pfile = '/u01/app/oracle/oradata/clntomig/init;


SQL> startup nomount;

SQL> @controlrecreate.sql

SQL> select status from V$instance;

STATUS
------
MOUNTED

Note :- In order to recover the database upto date, it has to be applied
logs of upto current log sequence. As per the below it will ask
for the log sequence to be applied. While it ask for the file
enter the name of the archived log of that particular log sequence
(of target database) as below, Once the logs upto current log
sequence is applied then enter CANCEL when it ask for the log
sequence and open the databsae with resetlogs option.

SQL> recover database until cancel using backup controlfile;
ORA-00279: change 214245 generated at 11/18/2010 10:35:25 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_36_%u_.arc
ORA-00280: change 214245 for thread 1 is in sequence #36


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/tomig/online_archive_logs/1_36_735307345.dbf

ORA-00279: change 234921 generated at 11/19/2010 08:17:06 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_37_%u
_.arc
ORA-00280: change 234921 for thread 1 is in sequence #37
ORA-00278: log file
'/u01/app/oracle/oradata/tomig/online_archive_logs/1_36_735307345.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/tomig/online_archive_logs/1_37_735307345.dbf
ORA-00279: change 236329 generated at 11/19/2010 08:55:06 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_38_%u_.arc
ORA-00280: change 236329 for thread 1 is in sequence #38
ORA-00278: log file
'/u01/app/oracle/oradata/tomig/online_archive_logs/1_37_735307345.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/tomig/online_archive_logs/1_38_735307345.dbf
ORA-00279: change 236442 generated at 11/19/2010 09:00:33 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_39_%u_.arc
ORA-00280: change 236442 for thread 1 is in sequence #39
ORA-00278: log file
'/u01/app/oracle/oradata/tomig/online_archive_logs/1_38_735307345.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/tomig/online_archive_logs/1_39_735307345.dbf
ORA-00279: change 238628 generated at 11/19/2010 10:24:55 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_40_%u
_.arc
ORA-00280: change 238628 for thread 1 is in sequence #40
ORA-00278: log file
'/u01/app/oracle/oradata/tomig/online_archive_logs/1_39_735307345.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
SQL> alter database open resetlogs;

Database altered.


SQL> select status from V$instance;

STATUS
------
OPEN

SQL> select name from V$database;

NAME
---------
CLNTOMIG


SQL> select name from V$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/clntomig/system01.dbf
/u01/app/oracle/oradata/clntomig/undo01.dbf
/u01/app/oracle/oradata/clntomig/sysaux01.dbf
/u01/app/oracle/oradata/clntomig/users01.dbf

SQL> SELECT * FROM v$LOG;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 0 20971520 2 YES UNUSED 0
2 1 1 20971520 2 NO CURRENT 236443 19-NOV-10




Cold Backup Cloning:-


Target dbname = tomig
clone dbname = clntomig


1. Shutdown the target database and take the cold backup of target database
backup of controlfile trace and pfile.

2. Create the directory structure for the clone database.

3. Copy the backups to the clone db and place the files to the appropirate directories.

i.e. Place the db files under oradata/clntomig folder and pfile to the
admin/clntomig/pfile directory.

4. Modify the clone db pfile parameters accordingly.

1. File location of trace files, dump file, controlfiles.
2. db_name = clntomig

IF you are doing the cloning on the same server then add the below parameters, else if your cloning on a different server with the same directory structure then the below parameters are not required.

1. db_file_name_convert = '/u01/app/oracle/oradata/tomig','/u01/app/oracle/oradata/clntomig'
2. log_file_name_convert = '/u01/app/oracle/oradata/tomig','/u01/app/oracle/oradata/clntomig'


5. Create the password file for the clone db.

unix :- $ orapwd file=$ORACLE_HOME/dbs/orapwclntomig password=sys entries=10

Windows :- > orapwd file=E:\oracle\product\10.2.0\db_1\database\PWDclntomig.ora entries=10

6. Create a New instance if the OS is windows.

>oradim -new -sid clntomig

7. Modify the Controlfile trace as below and save it as an sql script file. (controlrecreate.sql)

CREATE CONTROLFILE SET DATABASE "CLNTOMIG" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'/u01/app/oracle/oradata/clntomig/redo01.rdo',
'/u01/app/oracle/oradata/clntomig/redo02.rdo'
) SIZE 20M,
GROUP 2 (
'/u01/app/oracle/oradata/clntomig/redo03.rdo',
'/u01/app/oracle/oradata/clntomig/redo04.rdo'
) SIZE 20M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/clntomig/system01.dbf',
'/u01/app/oracle/oradata/clntomig/undo01.dbf',
'/u01/app/oracle/oradata/clntomig/sysaux01.dbf',
'/u01/app/oracle/oradata/clntomig/users01.dbf'
CHARACTER SET US7ASCII
/


8. Perfrom the following steps.

[oracle@rhel clntomig]$ ls -l
total 1419756
-rw-r--r-- 1 oracle oinstall 731 Nov 19 10:16 con.sql
-rw-r--r-- 1 oracle oinstall 1309 Nov 19 08:46 initclntomig.ora
-rw-r----- 1 oracle oinstall 524296192 Nov 19 10:15 sysaux01.dbf
-rw-r----- 1 oracle oinstall 524296192 Nov 19 10:15 system01.dbf
-rw-r----- 1 oracle oinstall 78651392 Nov 17 14:58 temp01.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov 19 10:15 undo01.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov 19 10:15 users01.dbf

[oracle@rhel clntomig]$ export ORACLE_SID=clntomig
[oracle@rhel clntomig]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 19 10:20:09 2010

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

Connected to an idle instance.

SQL> create spfile from pfile = '/u01/app/oracle/oradata/clntomig/initclntomig.ora';

File created.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 104859216 bytes
Database Buffers 176160768 bytes
Redo Buffers 2973696 bytes

SQL> @con.sql;

Control file created.

SQL> select status from V$instance;

STATUS
---------
MOUNTED

Note :- In order to recover the database upto date, it has to be applied
logs of upto current log sequence. As per the below it will ask
for the log sequence to be applied. While it ask for the file
enter the name of the archived log of that particular log sequence
(of target database) as below, Once the logs upto current log
sequence is applied then enter CANCEL when it ask for the log
sequence and open the databsae with resetlogs option.

SQL> recover database until cancel using backup controlfile;
ORA-00279: change 214245 generated at 11/18/2010 10:35:25 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_36_%u_.arc
ORA-00280: change 214245 for thread 1 is in sequence #36


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/tomig/online_archive_logs/1_36_735307345.dbf

ORA-00279: change 234921 generated at 11/19/2010 08:17:06 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_37_%u
_.arc
ORA-00280: change 234921 for thread 1 is in sequence #37
ORA-00278: log file
'/u01/app/oracle/oradata/tomig/online_archive_logs/1_36_735307345.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/tomig/online_archive_logs/1_37_735307345.dbf
ORA-00279: change 236329 generated at 11/19/2010 08:55:06 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_38_%u_.arc
ORA-00280: change 236329 for thread 1 is in sequence #38
ORA-00278: log file
'/u01/app/oracle/oradata/tomig/online_archive_logs/1_37_735307345.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/tomig/online_archive_logs/1_38_735307345.dbf
ORA-00279: change 236442 generated at 11/19/2010 09:00:33 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_39_%u_.arc
ORA-00280: change 236442 for thread 1 is in sequence #39
ORA-00278: log file
'/u01/app/oracle/oradata/tomig/online_archive_logs/1_38_735307345.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/tomig/online_archive_logs/1_39_735307345.dbf
ORA-00279: change 238628 generated at 11/19/2010 10:24:55 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_40_%u
_.arc
ORA-00280: change 238628 for thread 1 is in sequence #40
ORA-00278: log file
'/u01/app/oracle/oradata/tomig/online_archive_logs/1_39_735307345.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.

SQL> alter database open resetlogs;

Database altered.

SQL> select status from V$instance;

STATUS
------
OPEN

SQL> select name from V$database;

NAME
---------
CLNTOMIG


SQL> select name from V$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/clntomig/system01.dbf
/u01/app/oracle/oradata/clntomig/undo01.dbf
/u01/app/oracle/oradata/clntomig/sysaux01.dbf
/u01/app/oracle/oradata/clntomig/users01.dbf


RMAN Cloning - Same Server:-

Target dbname = tomig
clone dbname = clntomig


1. Take the rman backup of the target database and pfile backup.

2. Create the directory structure for the clone database.

3. Modify the clone db pfile parameters accordingly.

1. File location of trace files, dump file, controlfiles.
2. db_name = clntomig

IF you are doing the cloning on the same server then add the below parameters, else if your cloning on a different server with the same directory structure then the below parameters are not required.

1. db_file_name_convert = '/u01/app/oracle/oradata/tomig','/u01/app/oracle/oradata/clntomig'
2. log_file_name_convert = '/u01/app/oracle/oradata/tomig','/u01/app/oracle/oradata/clntomig'


4. Create the password file for the clone db.

unix :- $ orapwd file=$ORACLE_HOME/dbs/orapwclntomig password=sys entries=10

Windows :- > orapwd file=E:\oracle\product\10.2.0\db_1\database\PWDclntomig.ora entries=10

5. Create a New instance if the OS is windows.

>oradim -new -sid clntomig

6. Update the Entries in the tnsnames.ora file and listener.ora
according.

CLNTOMIG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rhel.manzoor.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = clntomig)
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = clntomig)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
)
)



7. Check whether the clond db is reaching by using tnsping utility.

[oracle@rhel clntomig]$ tnsping clntomig

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 19-NOV-2010 12:15:41

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

Used parameter files:
/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rhel.manzoor.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = clntomig)))
OK (0 msec)


8. Perform the below steps.


[oracle@rhel clntomig]$ export ORACLE_SID=clntomig
[oracle@rhel clntomig]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 19 12:16:35 2010

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

Connected to an idle instance.

SQL> create spfile from pfile = '/u01/app/oracle/oradata/clntomig/initclntomig.ora';

File created.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 104859216 bytes
Database Buffers 176160768 bytes
Redo Buffers 2973696 bytes

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Note:- Once the database instance is started we need to exit from the session.

[oracle@rhel admin]$ export ORACLE_SID=clntomig
[oracle@rhel admin]$ rman target sys/admin@tomig nocatalog auxiliary /

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Nov 19 12:20:11 2010

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

connected to target database: TOMIG (DBID=2728202513)
using target database control file instead of recovery catalog
connected to auxiliary database: CLNTOMIG (not mounted)


RMAN> list backup of database;


List of Backup Sets
===================

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 298.69M DISK 00:01:40 19-NOV-10
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20101119T120829
Piece Name: /u01/app/oracle/flash_recovery_area/TOMIG/backupset/2010_11_19/o1_mf_nnndf_TAG20101119T120829_6gd6v61w_.bkp
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 241342 19-NOV-10 /u01/app/oracle/oradata/tomig/system01.dbf
2 Full 241342 19-NOV-10 /u01/app/oracle/oradata/tomig/undo01.dbf
3 Full 241342 19-NOV-10 /u01/app/oracle/oradata/tomig/sysaux01.dbf
4 Full 241342 19-NOV-10 /u01/app/oracle/oradata/tomig/users01.dbf
5 Full 214245 18-NOV-10 /u01/app/oracle/oradata/tomig/test01.dbf

RMAN> duplicate target database to clntomig;

Starting Duplicate Db at 19-NOV-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

contents of Memory Script:
{
set until scn 241409;
set newname for datafile 1 to
"/u01/app/oracle/oradata/clntomig/system01.dbf";
set newname for datafile 2 to
"/u01/app/oracle/oradata/clntomig/undo01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/clntomig/sysaux01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/clntomig/users01.dbf";
set newname for datafile 5 to
"/u01/app/oracle/oradata/clntomig/test01.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 19-NOV-10
using channel ORA_AUX_DISK_1

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 /u01/app/oracle/oradata/clntomig/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/clntomig/undo01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/clntomig/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/clntomig/users01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/clntomig/test01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/TOMIG/backupset/2010_11_19/o1_mf_nnndf_TAG20101119T120829_6gd6v61w_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/flash_recovery_area/TOMIG/backupset/2010_11_19/o1_mf_nnndf_TAG20101119T120829_6gd6v61w_.bkp tag=TAG20101119T120829
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:26
Finished restore at 19-NOV-10
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLNTOMIG" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u01/app/oracle/oradata/clntomig/redo01.rdo', '/u01/app/oracle/oradata/clntomig/redo02.rdo' ) SIZE 20 M REUSE,
GROUP 2 ( '/u01/app/oracle/oradata/clntomig/redo03.rdo', '/u01/app/oracle/oradata/clntomig/redo04.rdo' ) SIZE 20 M REUSE
DATAFILE
'/u01/app/oracle/oradata/clntomig/system01.dbf'
CHARACTER SET US7ASCII


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

released channel: ORA_AUX_DISK_1
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=735481417 filename=/u01/app/oracle/oradata/clntomig/undo01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=735481417 filename=/u01/app/oracle/oradata/clntomig/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=735481417 filename=/u01/app/oracle/oradata/clntomig/users01.dbf

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

executing command: SET until clause

Starting recover at 19-NOV-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=158 devtype=DISK
datafile 5 not processed because file is read-only

starting media recovery

channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=41
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=42
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/TOMIG/backupset/2010_11_19/o1_mf_annnn_TAG20101119T121105_6gd703kh_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/flash_recovery_area/TOMIG/backupset/2010_11_19/o1_mf_annnn_TAG20101119T121105_6gd703kh_.bkp tag=TAG20101119T121105
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
archive log filename=/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_41_6gd7r2wm_.arc thread=1 sequence=41
channel clone_default: deleting archive log(s)
archive log filename=/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_41_6gd7r2wm_.arc recid=2 stamp=735481435
archive log filename=/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_42_6gd7r2g1_.arc thread=1 sequence=42
channel clone_default: deleting archive log(s)
archive log filename=/u01/app/oracle/flash_recovery_area/CLNTOMIG/archivelog/2010_11_19/o1_mf_1_42_6gd7r2g1_.arc recid=1 stamp=735481434
media recovery complete, elapsed time: 00:00:02
Finished recover at 19-NOV-10

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

Fixed Size 1218992 bytes
Variable Size 104859216 bytes
Database Buffers 176160768 bytes
Redo Buffers 2973696 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLNTOMIG" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u01/app/oracle/oradata/clntomig/redo01.rdo', '/u01/app/oracle/oradata/clntomig/redo02.rdo' ) SIZE 20 M REUSE,
GROUP 2 ( '/u01/app/oracle/oradata/clntomig/redo03.rdo', '/u01/app/oracle/oradata/clntomig/redo04.rdo' ) SIZE 20 M REUSE
DATAFILE
'/u01/app/oracle/oradata/clntomig/system01.dbf'
CHARACTER SET US7ASCII


contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/clntomig/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/clntomig/undo01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/clntomig/sysaux01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/clntomig/users01.dbf";
switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to /u01/app/oracle/oradata/clntomig/temp01.dbf in control file

cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/clntomig/undo01.dbf recid=1 stamp=735481457

cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/clntomig/sysaux01.dbf recid=2 stamp=735481457

cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/clntomig/users01.dbf recid=3 stamp=735481457

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=735481457 filename=/u01/app/oracle/oradata/clntomig/undo01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=735481457 filename=/u01/app/oracle/oradata/clntomig/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=735481457 filename=/u01/app/oracle/oradata/clntomig/users01.dbf

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

database opened

contents of Memory Script:
{
catalog clone datafilecopy "/u01/app/oracle/oradata/clntomig/test01.dbf";
switch clone datafile 5 to datafilecopy
"/u01/app/oracle/oradata/clntomig/test01.dbf";
#online the readonly tablespace
sql clone "alter tablespace TEST online";
}
executing Memory Script

cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/clntomig/test01.dbf recid=4 stamp=735481472

datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=735481472 filename=/u01/app/oracle/oradata/clntomig/test01.dbf

sql statement: alter tablespace TEST online
Finished Duplicate Db at 19-NOV-10

RMAN> exit



9.

[oracle@rhel clntomig]$ export ORACLE_SID=clntomig
[oracle@rhel clntomig]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 19 12:25:20 2010

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select status from V$instance;

STATUS
------------
OPEN


SQL> select name from V$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/clntomig/system01.dbf
/u01/app/oracle/oradata/clntomig/undo01.dbf
/u01/app/oracle/oradata/clntomig/sysaux01.dbf
/u01/app/oracle/oradata/clntomig/users01.dbf
/u01/app/oracle/oradata/clntomig/test01.dbf

--create a new temporary tablespace and drop the old one.

SQL> create temporary tablespace temp01 tempfile
'/u01/app/oracle/oradata/clntomig/temp02.dbf size 100m;

SQL> alter database default temporary tablespace temp01;

SQL> drop tablespace temp including contents and datafiles;



RMAN Cloning in Different Server:-


For Rman cloning in different server , the same methods as mentioned
above has to be followed, and the below things to be taken care.

1) Ensure to update the tnsnames.ora and the listener.ora files with correct details.
i.e. the destination server database details has to be updated in production
tnsnames.ora file and SID description has to be updated in the listener.ora
file on the destination server.

2) Copy the rman backup pieces from the production server to the destination
server and paste them in the same path as it exists in the production server.
(If the backup pieces are not copied to the destination server then while executing the duplicate command in rman will get a error as no backup found).

3) Create the duplicate database in a new host. If the same directory structure is
available, then you can use the NOFILENAMECHECK option and reuse the target
datafile filenames for the duplicate datafiles.

-----------------------------------------------
Note

1) Create the duplicate database by using the SET UNTIL command or UNTIL clause
of the DUPLICATE command to recover it to a past time. By default, the
DUPLICATE command creates the database using the most recent backups of the
target database and then performs recovery to the most recent consistent point
contained in the incremental and archived redo log backups.

2)Use the duplicate database without a recovery catalog.

3)Register the duplicate database in the same recovery catalog as the target database. This option is possible because the duplicate database receives a new database identifier during duplication. If you copy the target database with operating system utilities, then the database identifier of the copied database remains the same so you cannot register it in the same recovery catalog (unless you change its DBID with the DBNEWID utility, described in Oracle Database Utilities ).

==================================================================================

Thanks...
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example, show how to take different types of Oracle backups using RMAN.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now