Jephe Wu - http://linuxtechres.blogspot.com
Environment: OL 5.7 32bit, Oracle database 11.2, sid=orcl
Objective: duplicate database on the same server then change db_name from orcl to devdb
concept: duplicate line in /etc/oratab, make orcl and devdb instance, then make everything in password file, spfile/pfile, controlfile, redo log, data file from orcl to devdb, only leave db_name in pfile/spfile as orcl for rman restore from orcl database backup, then use nid to change db_name
Note: If you are using DUPLICATE to create a standby database, then the name must be the same as the primary database
Part I - user rman to duplicate database on the same host
Steps:
1. use rman to backup source db
rman target /
rman> backup database plus archivelog;
handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2012_05_04/o1_mf_annnn_TAG20120504T204647_7t7dwqjk_.bkp
tag=TAG20120504T204647 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 04-MAY-12
Starting Control File and SPFILE Autobackup at 04-MAY-12
piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2012_05_04/o1_mf_s_782426808_7t7dws7b_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 04-MAY-12
record down data file names and redo log names
sqlplus / as sysdba
sql> select name from v$datafile;
sql> select name from v$tempfile;
sql> select member from v$logfile;
sql> select name,open_mode,dbid from v$database;
2. vi /etc/oratab to add devdb line
orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N
devdb:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N
. oraenv
orcl
cd $ORACLE_HOME/dbs
sqlplus / as sysdba
sql> create pfile='initdevdb.ora' from spfile;
3. set up devdb instance
. oraenv
devdb
cd $ORACLE_HOME/dbs
vi initdevdb.ora to change all orcl to devdb, except for db_name=orcl, otherwise, you are not able to mount database, this db_name will be changed after everything is done.
Note: you can also use the following parameters, after done, remove them.
db_file_name_convert = (PROD,devdb)
log_file_name_convert=(PROD,devdb)
then mkdir -p for those changed path
You must verify that all paths are accessible on the host where the database is being duplicated
example of destination database host pfile parameters:
------------
DB_NAME=devdb
CONTROL_FILES=(/dup/oracle/oradata/devdb/control01.ctl,
/dup/oracle/oradata/devdb/control02.ctl)
DB_FILE_NAME_CONVERT=(/oracle/oradata/prod/,/oracle/oradata/devdb/)
LOG_FILE_NAME_CONVERT=(/oracle/oradata/prod/redo,/oracle/oradata/devdb/redo)
----------
sqlplus / as sysdba
sql> startup nomount;
sql> create spfile from pfile;
sql> show parameter spfile;
sql> exit;
rman target /
rman> restore controlfile from /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2012_05_04/o1_mf_s_782426808_7t7dws7b_.bkp
4. set new logfile names
. oraenv
devdb
sqlplus / as sysdba
sql> alter database mount;
sql> alter database rename file '/home/oracle/app/oracle/oradata/orcl/redo01.log' to
'/home/oracle/app/oracle/oradata/devdb/redo01.log';
sql> alter database rename file '/home/oracle/app/oracle/oradata/orcl/redo02.log' to
'/home/oracle/app/oracle/oradata/devdb/redo02.log';
sql> alter database rename file '/home/oracle/app/oracle/oradata/orcl/redo03.log' to
'/home/oracle/app/oracle/oradata/devdb/redo03.log';
5. rman restore and recover
. oraenv
devdb
rman target /
rman>
run { set newname for datafile 1 to '/home/oracle/app/oracle/oradata/devdb/system01.dbf';
set newname for datafile 2 to '/home/oracle/app/oracle/oradata/devdb/sysaux01.dbf';
set newname for datafile 3 to '/home/oracle/app/oracle/oradata/devdb/undotbs01.dbf';
set newname for datafile 4 to '/home/oracle/app/oracle/oradata/devdb/users01.dbf';
set newname for datafile 5 to '/home/oracle/app/oracle/oradata/devdb/example01.dbf';
restore database;
switch database to copy;
recover database;
alter database open resetlogs;
}
6. change db_name and dbid
. oraenv
devdb
sqlplus / as sysdba
sql> set line 32000
sql> select name from v$database;
sql> shutdown immediate;
sql> startup mount;
sql> exit
$ cd $ORACLE_HOME/dbs
$ orapwd file=orapwdevdb
note: filename is with prefix orapw, not orapwd
$ nid TARGET=SYS/oracle dbname=devdb
Connected to server version 11.2.0
Control Files in database:
/home/oracle/app/oracle/oradata/devdb/control01.ctl
/home/oracle/app/oracle/flash_recovery_area/devdb/control02.ctl
Change database ID and database name ORCL to DEVDB? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1294051154 to 687139782
Changing database name from ORCL to DEVDB
Control File /home/oracle/app/oracle/oradata/devdb/control01.ctl - modified
Control File /home/oracle/app/oracle/flash_recovery_area/devdb/control02.ctl - modified
Datafile /home/oracle/app/oracle/oradata/devdb/system01.db - dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/devdb/sysaux01.db - dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/devdb/undotbs01.db - dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/devdb/users01.db - dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/devdb/example01.db - dbid changed, wrote new name
Control File /home/oracle/app/oracle/oradata/devdb/control01.ctl - dbid changed, wrote new name
Control File /home/oracle/app/oracle/flash_recovery_area/devdb/control02.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to DEVDB.
Modify parameter file and generate a new password file before restarting.
Database ID for database DEVDB changed to 687139782.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
7. after change, restart db
. oraenv
devdb
sqlplus / as sysdba
sql> startup nomount;
sql> alter system set db_name=devdb scope=spfile;
sql> startup mount;
sql> alter database open resetlogs;
sql> select name,open_mode from v$database;
If you used db_file_name_convert and log_file_name_convert, you can now reset them:
alter system reset db_file_name_convert scope=spfile sid='*';
alter system reset log_file_name_convert scope=spfile sid='*';
8. verify
sqlplus / as sysdba
sql> select member from v$logfile;
sql> select name from v$tempfile;
sql> select name from v$datafile;
Sql> alter tablespace temp add tempfile '/home/oracle/app/oracle/oradata/devdb/temp01.dbf' size 100m autoextend on next 10m ;
Sql> alter tablespace temp drop tempfile '/home/oracle/app/oracle/oradata/orcl/temp01.dbf';
Sql> quit;
9. listener.ora and tnsname.ora
Add entries for devdb database in listener.ora and tnsname.ora if needed.
According to
http://dba.stackexchange.com/questions/338/can-i-change-the-sid-of-an-oracle-database, change additional items after dbname change as follows:
If database name being changed only then resetlogs is not required: 1. startup database in mount mode shutdown immediate startup mount 2. run nid to change database name: nid target=sys/syspassword@dbtns dbname=newname setname=YES 3. shutdown and start database in mount mode: shutdown immediate startup mount 4. change db_name in spfile (or in pfile editing the file): alter system set db_name=newname scope=spfile; 5. recreate password file: orapwd file=orapwnewname password=syspassword 6. startup the database startup 7. post rename steps: change SID in listener.ora correct tnsnames.ora remove old trace directories change /etc/oratab (UNIX) or rename windows service using oradim
10. references
a. Rman backup and restore in 11gR2
http://docs.oracle.com/cd/E11882_01/backup.112/e10642.pdf
b. http://dba-oracle.com/t_rman_clone_copy_database.htm
c. change db_name - http://docs.oracle.com/cd/B10500_01/server.920/a96652/ch14.htm
Part II - duplicate to remote host without connecting to target and catalog
Refer to
RMAN 11GR2 : DUPLICATE WITHOUT CONNECTING TO TARGET DATABASE [ID 874352.1] |
Method 1:
db_name=v11dup
db_unique_name=v11dup
db_recovery_file_dest='/recovery_area'
control_files='/oradata/v11dup/control01.ctl'
audit_file_dest='/oradata/admin/v11dup'
compatible='11.2.0.0.0'
db_recovery_file_dest_size=100G
diagnostic_dest='/oradata/admin/v11dup'
If files are to be restored to a different location:
db_file_name_convert=('<old path>' , '<new path>')
log_file_name_convert=('<old path>' , '<new path>')
Note:
If a database must be accessed from another host, you must set up a password file and Oracle Net connectivity
1. Create an Oracle Password File for the Auxiliary Instance
2. Ensure Oracle Net Connectivity to the Auxiliary Instance
The auxiliary instance must be accessible through Oracle Net. Before proceeding, start SQL*Plus to ensure that you can establish a connection to the auxiliary instance. Note that you must connect to the auxiliary instance with
SYSDBA
privileges, so a password file must exist.
In this example, we use only auxiliary channel to duplicate, without connecting to target and catalog, we copy FRA database backup to destination host, and put under any directory /home/oracle/DEVDB, this is called backup-based duplication, without connecting to target and catalog
Steps:
Backup-based duplication:
1. if you don't connect to target or catalog, only connect to auxiliary host for duplication, you must put the rman database backup files on destination host location specified by the BACKUP LOCATION option which must contain sufficient backup sets, image copies, and archived logs to restore all of the files being duplicated, and recover them to the desired point in time. This can be any directory.
2. Preparation on source host
a. on source: backup database then copy to destination.
rman> backup database plus archivelog;
generate pfile from spfile if necessary, then copy to auxiliary host, you can put in any folder.
b. on destination:
modify pfile as follows , use db_file_name_convert and log_file_name_convert in pfile if needed.
DB_NAME=testdb
CONTROL_FILES=(/oracle/oradata/testdb/control01.ctl,
/oracle/oradata/testdb/control02.ctl)
DB_FILE_NAME_CONVERT=(prod,testdb)
LOG_FILE_NAME_CONVERT=(prod,testdb)
startup nomount
create directory accordingly for testdb, such as 'mkdir -p /oracle/oradata/testdb'.
c. use rman to make database duplication
run rman on auxiliary host testdb as follows to duplicate database:
[oracle@testdb dbs]$ rman
Recovery Manager: Release 11.2.0.1.0 - Production on Sun May 6 01:54:11 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Note: you don't have to connect to target host(source host)
target database Password:
connected to target database: DEVDB (DBID=687139782)
RMAN> connect auxiliary /
connected to auxiliary database: TESTDB (not mounted)
RMAN> duplicate database devdb to testdb backup location '/home/oracle/DEVDB';
note: on source host, FRA directory is at '/home/oracle/app/oracle/flash_recovery_area_devdb/DEVDB/';
note: since you have copied backup over to testdb, you don't have to connect to target and use the same directory as target here, you can actually copy backup to any directory on auxiliary host.
Starting Duplicate Db at 06-MAY-12
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
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 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''DEVDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''TESTDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''DEVDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''TESTDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
Starting restore at 06-MAY-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/app/oracle/flash_recovery_area_devdb/DEVDB/autobackup/2012_05_06/o1_mf_s_782529031_7tbjq7ml_.bkp
channel ORA_AUX_DISK_1: piece handle=/home/oracle/app/oracle/flash_recovery_area_devdb/DEVDB/autobackup/2012_05_06/o1_mf_s_782529031_7tbjq7ml_.bkp tag=TAG20120506T011031
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/home/oracle/oradata/testdb/control01.ctl
output file name=/home/oracle/oradata/testdb/control02.ctl
Finished restore at 06-MAY-12
database mounted
contents of Memory Script:
{
set until scn 1815156;
set newname for datafile 1 to
"/home/oracle/app/oracle/oradata/testdb/system01.dbf";
set newname for datafile 2 to
"/home/oracle/app/oracle/oradata/testdb/sysaux01.dbf";
set newname for datafile 3 to
"/home/oracle/app/oracle/oradata/testdb/undotbs01.dbf";
set newname for datafile 4 to
"/home/oracle/app/oracle/oradata/testdb/users01.dbf";
set newname for datafile 5 to
"/home/oracle/app/oracle/oradata/testdb/example01.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
Starting restore at 06-MAY-12
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 /home/oracle/app/oracle/oradata/testdb/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /home/oracle/app/oracle/oradata/testdb/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /home/oracle/app/oracle/oradata/testdb/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /home/oracle/app/oracle/oradata/testdb/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /home/oracle/app/oracle/oradata/testdb/example01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/app/oracle/flash_recovery_area_devdb/DEVDB/backupset/2012_05_06/o1_mf_nnndf_TAG20120506T010904_7tbjnjvm_.bkp
channel ORA_AUX_DISK_1: piece handle=/home/oracle/app/oracle/flash_recovery_area_devdb/DEVDB/backupset/2012_05_06/o1_mf_nnndf_TAG20120506T010904_7tbjnjvm_.bkp tag=TAG20120506T010904
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:25
Finished restore at 06-MAY-12
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=782531765 file name=/home/oracle/app/oracle/oradata/testdb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=782531765 file name=/home/oracle/app/oracle/oradata/testdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=782531765 file name=/home/oracle/app/oracle/oradata/testdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=782531765 file name=/home/oracle/app/oracle/oradata/testdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=10 STAMP=782531765 file name=/home/oracle/app/oracle/oradata/testdb/example01.dbf
contents of Memory Script:
{
set until scn 1815156;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 06-MAY-12
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 9 is already on disk as file /home/oracle/app/oracle/flash_recovery_area_devdb/DEVDB/archivelog/2012_05_06/o1_mf_1_9_7tbjq5q2_.arc
archived log file name=/home/oracle/app/oracle/flash_recovery_area_devdb/DEVDB/archivelog/2012_05_06/o1_mf_1_9_7tbjq5q2_.arc thread=1 sequence=9
media recovery complete, elapsed time: 00:00:00
Finished recover at 06-MAY-12
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''TESTDB'' 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 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
sql statement: alter system set db_name = ''TESTDB'' 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 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TESTDB" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/home/oracle/app/oracle/oradata/testdb/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/home/oracle/app/oracle/oradata/testdb/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/home/oracle/app/oracle/oradata/testdb/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/home/oracle/app/oracle/oradata/testdb/system01.dbf'
CHARACTER SET AL32UTF8
contents of Memory Script:
{
set newname for tempfile 1 to
"/home/oracle/app/oracle/oradata/testdb/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/home/oracle/app/oracle/oradata/testdb/sysaux01.dbf",
"/home/oracle/app/oracle/oradata/testdb/undotbs01.dbf",
"/home/oracle/app/oracle/oradata/testdb/users01.dbf",
"/home/oracle/app/oracle/oradata/testdb/example01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /home/oracle/app/oracle/oradata/testdb/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/testdb/sysaux01.dbf RECID=1 STAMP=782531775
cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/testdb/undotbs01.dbf RECID=2 STAMP=782531775
cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/testdb/users01.dbf RECID=3 STAMP=782531775
cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/testdb/example01.dbf RECID=4 STAMP=782531775
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=782531775 file name=/home/oracle/app/oracle/oradata/testdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=782531775 file name=/home/oracle/app/oracle/oradata/testdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=782531775 file name=/home/oracle/app/oracle/oradata/testdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=782531775 file name=/home/oracle/app/oracle/oradata/testdb/example01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 06-MAY-12
Refer to http://aprakash.wordpress.com/2012/01/11/set-newname-command-made-easier-in-11gr2/
$ rman
rman> connect auxiliary /
rman> run {
set newname for database to '/oradata/devdb/%b';
set newname for tempfile 1 to '/oradata/devdb/%b';
duplicate database 'prod' 12345678 to orcl
backup location '/rman/backup/orcl'
logfile
group 1 ('/path','/path2') size 50m reuse,
group 2 ('/path','/path2') size 50m reuse;
}
Note: 12345678 is the dbid.
or from http://docs.oracle.com/cd/E11882_01/backup.112/e10642.pdf
RUN
{
SET NEWNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/oradata3/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/oradata4/users01.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/oradata5/users02.dbf';
SET NEWNAME FOR TEMPFILE 1 TO '/oradatat/temp01.dbf';
DUPLICATE TARGET DATABASE TO dupdb
SKIP TABLESPACE tools
LOGFILE
GROUP 1 ('/duplogs/redo01a.log',
'/duplogs/redo01b.log') SIZE 4M REUSE,
GROUP 2 ('/duplogs/redo02a.log',
'/duplogs/redo02b.log') SIZE 4M REUSE;
}
or use configure auxname to rename datafile, then rman run {} part will use this setting to rename datafiles.
rman>
CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf';
CONFIGURE AUXNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf';
CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oradata3/undotbs01.dbf';
CONFIGURE AUXNAME FOR DATAFILE 4 TO '/oradata4/users01.dbf';
CONFIGURE AUXNAME FOR DATAFILE 5 TO '/oradata5/users02.dbf';
run
{
SET NEWNAME FOR TEMPFILE 1 TO '/oradatat/temp01.dbf';
DUPLICATE TARGET DATABASE
TO dupdb
SKIP TABLESPACE tools
LOGFILE
GROUP 1 ('/duplogs/redo01a.log',
'/duplogs/redo01b.log') SIZE 4M REUSE,
GROUP 2 ('/duplogs/redo02a.log',
'/duplogs/redo02b.log') SIZE 4M REUSE;
}
Method 3. if you have chance to shutdown source db, here is faster way:
refer to http://www.dba-oracle.com/oracle_tips_db_copy.htm
a. on source db:
alter database backup controlfile to trace
sqlplus / as sysdba
sql> shutdown immediate;
copy datafiles, pfile, controlfile trace backup to destination, you can change datafile name and path if needed.
b. on destination db:
modify tracefile accordingly, such as change
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS
to
CREATE CONTROLFILE SET DATABASE "DEVDB" RESETLOGS
remove
“recover database” and “alter database open”
rename datafile if necessary
Create the bdump, udump and cdump directories
run trace file to create control file on new host:
sqlplus / as sysdba @tracefile.sql
enable archive logmode for new server
4. error messages:
RMAN-05541: no archived logs found in target database