Database should be using a password file
Create Auxiliary database directories:
create $ORACLE_BASE diag directories
create $ORACLE_BASE admin directories
Create Auxiliary pfile from target database:
Set oraenv for target database and create pfile from spfile.
[oracle@hostname ~]$ . oraenv
ORACLE_SID = [target] ?
The Oracle base for ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1 is /u02/app/oracle
[oracle@hostname ~]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 22 18:00:24 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> create pfile='/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora' from pfile;
Edit the pfile and make the following changes so all values reference aux database
audit_file_dest
control_files
db_name
dispatchers
instance_name
db_unique_name
db_file_name_convert=('target','aux') -- replace target instance name and aux instance name
log_file_name_convert=('target','aux') -- replace target instance name and aux instance name
Start the AUX instance:
Set the ORACLE_SID to the aux database and create a password file.
Start the Auxiliary instance.
[oracle@hostname ~]$ ORACLE_SID=aux11g
[oracle@hostname ~]$ export ORACLE_SID
[oracle@hostname ~]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 23 13:20:15 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to an idle instance.
SQL> startup nomount pfile='/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora'
[oracle@hostname ~]$ export ORACLE_SID
[oracle@hostname ~]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 23 13:20:15 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to an idle instance.
SQL> startup nomount pfile='/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora'
Configure Network files:
Modify the the tnsnames.ora and add a entry for auxiliary database.
Modify the listener.ora file and add the following:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = aux11g)
(ORACLE_HOME = /u02/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = aux11g)
)
)
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = aux11g)
(ORACLE_HOME = /u02/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = aux11g)
)
)
Reload listener
Duplicate database:
Connect RMAN to target and auxiliary instances and start the duplication.
[oracle@hostname ~]$ echo $ORACLE_SID
aux11g
[oracle@hostname ~]$ rman target='sys/whit3$0x@target' auxiliary /
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jul 22 18:02:42 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TARGET (DBID=4144092930)
connected to auxiliary database: AUX11G (not mounted)
RMAN> duplicate target database to aux11g
2> pfile='/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora';
aux11g
[oracle@hostname ~]$ rman target='sys/whit3$0x@target' auxiliary /
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jul 22 18:02:42 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TARGET (DBID=4144092930)
connected to auxiliary database: AUX11G (not mounted)
RMAN> duplicate target database to aux11g
2> pfile='/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora';
Add a entry in oratab and add database to srvctl.
Complete output from duplicate command is below.
[oracle@kundun ~]$ rman target='sys/whit3$0x@target' auxiliary /
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jul 22 18:02:42 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TARGET (DBID=4144092930)
connected to auxiliary database: AUX11G (not mounted)
RMAN> duplicate target database to aux11g
2> pfile='/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora';
Starting Duplicate Db at 22-JUL-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=13 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 1046224896 bytes
Fixed Size 1341140 bytes
Variable Size 616565036 bytes
Database Buffers 423624704 bytes
Redo Buffers 4694016 bytes
contents of Memory Script:
{
sql clone "alter system set control_files =
''+DATA/aux11g/controlfile/current.267.757188331'', ''+REC/aux11g/controlfile/current.270.757188331'' comment=
''Set by RMAN'' scope=spfile";
sql clone "alter system set db_name =
''TARGET'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''AUX11G'' 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 control_files = ''+DATA/aux11g/controlfile/current.267.757188331'', ''+REC/aux11g/controlfile/current.270.757188331'' comment= ''Set by RMAN'' scope=spfile
sql statement: alter system set db_name = ''TARGET'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''AUX11G'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 1046224896 bytes
Fixed Size 1341140 bytes
Variable Size 616565036 bytes
Database Buffers 423624704 bytes
Redo Buffers 4694016 bytes
Starting restore at 22-JUL-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=125 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 +REC/target/autobackup/2011_07_19/s_756923349.266.756923351
channel ORA_AUX_DISK_1: piece handle=+REC/target/autobackup/2011_07_19/s_756923349.266.756923351 tag=TAG20110719T162909
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:06
output file name=+DATA/aux11g/controlfile/current.267.757188331
output file name=+REC/aux11g/controlfile/current.270.757188331
Finished restore at 22-JUL-11
database mounted
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.
contents of Memory Script:
{
set until scn 767457;
set newname for datafile 1 to
"+data";
set newname for datafile 2 to
"+data";
set newname for datafile 3 to
"+data";
set newname for datafile 4 to
"+data";
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
Starting restore at 22-JUL-11
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 +data
channel ORA_AUX_DISK_1: restoring datafile 00002 to +data
channel ORA_AUX_DISK_1: restoring datafile 00003 to +data
channel ORA_AUX_DISK_1: restoring datafile 00004 to +data
channel ORA_AUX_DISK_1: reading from backup piece +REC/target/backupset/2011_07_19/nnndf0_tag20110719t162529_0.263.756923131
channel ORA_AUX_DISK_1: piece handle=+REC/target/backupset/2011_07_19/nnndf0_tag20110719t162529_0.263.756923131 tag=TAG20110719T162529
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:16
Finished restore at 22-JUL-11
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=757188483 file name=+DATA/aux11g/datafile/system.268.757188349
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=757188483 file name=+DATA/aux11g/datafile/sysaux.270.757188349
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=757188483 file name=+DATA/aux11g/datafile/undotbs1.271.757188349
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=757188483 file name=+DATA/aux11g/datafile/users.272.757188349
contents of Memory Script:
{
set until scn 767457;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 22-JUL-11
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 67 is already on disk as file +REC/target/archivelog/2011_07_19/thread_1_seq_67.264.756923347
archived log for thread 1 with sequence 68 is already on disk as file +REC/target/archivelog/2011_07_19/thread_1_seq_68.268.756946805
archived log file name=+REC/target/archivelog/2011_07_19/thread_1_seq_67.264.756923347 thread=1 sequence=67
archived log file name=+REC/target/archivelog/2011_07_19/thread_1_seq_68.268.756946805 thread=1 sequence=68
media recovery complete, elapsed time: 00:00:10
Finished recover at 22-JUL-11
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''AUX11G'' 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 1046224896 bytes
Fixed Size 1341140 bytes
Variable Size 616565036 bytes
Database Buffers 423624704 bytes
Redo Buffers 4694016 bytes
sql statement: alter system set db_name = ''AUX11G'' 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 1046224896 bytes
Fixed Size 1341140 bytes
Variable Size 616565036 bytes
Database Buffers 423624704 bytes
Redo Buffers 4694016 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUX11G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '+data', '+rec' ) SIZE 50 M REUSE,
GROUP 2 ( '+data', '+rec' ) SIZE 50 M REUSE,
GROUP 3 ( '+data', '+rec' ) SIZE 50 M REUSE
DATAFILE
'+DATA/aux11g/datafile/system.268.757188349'
CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
set newname for tempfile 1 to
"+data";
switch clone tempfile all;
catalog clone datafilecopy "+DATA/aux11g/datafile/sysaux.270.757188349",
"+DATA/aux11g/datafile/undotbs1.271.757188349",
"+DATA/aux11g/datafile/users.272.757188349";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to +data in control file
cataloged datafile copy
datafile copy file name=+DATA/aux11g/datafile/sysaux.270.757188349 RECID=1 STAMP=757188515
cataloged datafile copy
datafile copy file name=+DATA/aux11g/datafile/undotbs1.271.757188349 RECID=2 STAMP=757188515
cataloged datafile copy
datafile copy file name=+DATA/aux11g/datafile/users.272.757188349 RECID=3 STAMP=757188515
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=757188515 file name=+DATA/aux11g/datafile/sysaux.270.757188349
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=757188515 file name=+DATA/aux11g/datafile/undotbs1.271.757188349
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=757188515 file name=+DATA/aux11g/datafile/users.272.757188349
contents of Memory Script:
{
Alter clone database open resetlogs;
sql clone "create pfile= ''/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora'' from spfile";
}
executing Memory Script
database opened
sql statement: create pfile= ''/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora'' from spfile
Finished Duplicate Db at 22-JUL-11
RMAN>
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jul 22 18:02:42 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TARGET (DBID=4144092930)
connected to auxiliary database: AUX11G (not mounted)
RMAN> duplicate target database to aux11g
2> pfile='/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora';
Starting Duplicate Db at 22-JUL-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=13 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 1046224896 bytes
Fixed Size 1341140 bytes
Variable Size 616565036 bytes
Database Buffers 423624704 bytes
Redo Buffers 4694016 bytes
contents of Memory Script:
{
sql clone "alter system set control_files =
''+DATA/aux11g/controlfile/current.267.757188331'', ''+REC/aux11g/controlfile/current.270.757188331'' comment=
''Set by RMAN'' scope=spfile";
sql clone "alter system set db_name =
''TARGET'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''AUX11G'' 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 control_files = ''+DATA/aux11g/controlfile/current.267.757188331'', ''+REC/aux11g/controlfile/current.270.757188331'' comment= ''Set by RMAN'' scope=spfile
sql statement: alter system set db_name = ''TARGET'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''AUX11G'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 1046224896 bytes
Fixed Size 1341140 bytes
Variable Size 616565036 bytes
Database Buffers 423624704 bytes
Redo Buffers 4694016 bytes
Starting restore at 22-JUL-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=125 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 +REC/target/autobackup/2011_07_19/s_756923349.266.756923351
channel ORA_AUX_DISK_1: piece handle=+REC/target/autobackup/2011_07_19/s_756923349.266.756923351 tag=TAG20110719T162909
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:06
output file name=+DATA/aux11g/controlfile/current.267.757188331
output file name=+REC/aux11g/controlfile/current.270.757188331
Finished restore at 22-JUL-11
database mounted
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.
contents of Memory Script:
{
set until scn 767457;
set newname for datafile 1 to
"+data";
set newname for datafile 2 to
"+data";
set newname for datafile 3 to
"+data";
set newname for datafile 4 to
"+data";
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
Starting restore at 22-JUL-11
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 +data
channel ORA_AUX_DISK_1: restoring datafile 00002 to +data
channel ORA_AUX_DISK_1: restoring datafile 00003 to +data
channel ORA_AUX_DISK_1: restoring datafile 00004 to +data
channel ORA_AUX_DISK_1: reading from backup piece +REC/target/backupset/2011_07_19/nnndf0_tag20110719t162529_0.263.756923131
channel ORA_AUX_DISK_1: piece handle=+REC/target/backupset/2011_07_19/nnndf0_tag20110719t162529_0.263.756923131 tag=TAG20110719T162529
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:16
Finished restore at 22-JUL-11
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=757188483 file name=+DATA/aux11g/datafile/system.268.757188349
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=757188483 file name=+DATA/aux11g/datafile/sysaux.270.757188349
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=757188483 file name=+DATA/aux11g/datafile/undotbs1.271.757188349
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=757188483 file name=+DATA/aux11g/datafile/users.272.757188349
contents of Memory Script:
{
set until scn 767457;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 22-JUL-11
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 67 is already on disk as file +REC/target/archivelog/2011_07_19/thread_1_seq_67.264.756923347
archived log for thread 1 with sequence 68 is already on disk as file +REC/target/archivelog/2011_07_19/thread_1_seq_68.268.756946805
archived log file name=+REC/target/archivelog/2011_07_19/thread_1_seq_67.264.756923347 thread=1 sequence=67
archived log file name=+REC/target/archivelog/2011_07_19/thread_1_seq_68.268.756946805 thread=1 sequence=68
media recovery complete, elapsed time: 00:00:10
Finished recover at 22-JUL-11
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''AUX11G'' 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 1046224896 bytes
Fixed Size 1341140 bytes
Variable Size 616565036 bytes
Database Buffers 423624704 bytes
Redo Buffers 4694016 bytes
sql statement: alter system set db_name = ''AUX11G'' 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 1046224896 bytes
Fixed Size 1341140 bytes
Variable Size 616565036 bytes
Database Buffers 423624704 bytes
Redo Buffers 4694016 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUX11G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '+data', '+rec' ) SIZE 50 M REUSE,
GROUP 2 ( '+data', '+rec' ) SIZE 50 M REUSE,
GROUP 3 ( '+data', '+rec' ) SIZE 50 M REUSE
DATAFILE
'+DATA/aux11g/datafile/system.268.757188349'
CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
set newname for tempfile 1 to
"+data";
switch clone tempfile all;
catalog clone datafilecopy "+DATA/aux11g/datafile/sysaux.270.757188349",
"+DATA/aux11g/datafile/undotbs1.271.757188349",
"+DATA/aux11g/datafile/users.272.757188349";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to +data in control file
cataloged datafile copy
datafile copy file name=+DATA/aux11g/datafile/sysaux.270.757188349 RECID=1 STAMP=757188515
cataloged datafile copy
datafile copy file name=+DATA/aux11g/datafile/undotbs1.271.757188349 RECID=2 STAMP=757188515
cataloged datafile copy
datafile copy file name=+DATA/aux11g/datafile/users.272.757188349 RECID=3 STAMP=757188515
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=757188515 file name=+DATA/aux11g/datafile/sysaux.270.757188349
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=757188515 file name=+DATA/aux11g/datafile/undotbs1.271.757188349
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=757188515 file name=+DATA/aux11g/datafile/users.272.757188349
contents of Memory Script:
{
Alter clone database open resetlogs;
sql clone "create pfile= ''/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora'' from spfile";
}
executing Memory Script
database opened
sql statement: create pfile= ''/u02/app/oracle/admin/aux11g/pfile/initaux11g.ora'' from spfile
Finished Duplicate Db at 22-JUL-11
RMAN>
******************************************
keywords: duplicate rman
******************************************
rdbms version: 11.2.0.1
******************************************
No comments:
Post a Comment