结束了以前手工备份恢复,弄两份init.ora来操作的过程。。。
在备库创建目录:
mkdir -p /u01/app/oracle/admin/travel/adumpmkdir -p /u01/app/oracle/admin/travel/bdump
mkdir -p /u01/app/oracle/admin/travel/cdump
mkdir -p /u01/app/oracle/admin/travel/udump
mkdir -p /u01/app/oracle/oradata/travel
mkdir -p /u01/app/oracle/diag/rdbms/travel/travel
mkdir -p /u01/app/oracle/oradata/travel
travel的参数文件:
*.audit_file_dest='/u01/app/oracle/admin/travel/adump'
*.audit_trail='none'
*.compatible='11.2.0.3.0'
*.control_files='/u01/app/oracle/oradata/travel/control01.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='travel'
*.diagnostic_dest='/u01/app/oracle'
*.open_cursors=300
*.pga_aggregate_target=121634816
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=529145600
*.undo_tablespace='UNDOTBS1'
*.job_queue_processes=10
*.db_unique_name='travel'
*.log_archive_dest_1='location=/u01/archive/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=travel'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_max_processes=5
rman target /
backup database include current controlfile plus archivelog format='/test/clonedb/%U.bak';
rman target sys/oracle@bb auxiliary sys/oracle@travel
run{
set newname for datafile 1 to '/test/clonedb/SYSTEM01.DBF';
set newname for datafile 2 to '/test/clonedb/undotbs01.DBF';
set newname for datafile 3 to '/test/clonedb/sysaux01.DBF';
set newname for datafile 4 to '/test/clonedb/users01.DBF';
set newname for datafile 5 to '/test/clonedb/temp01.DBF';
duplicate target database to travel nofilenamecheck logfile
'/test/clonedb/redo01.log' size 10m,
'/test/clonedb/redo02.log' size 10m,
'/test/clonedb/redo03.log' size 10m;
}
travel.env
===================================
umask 022
TMP=/tmp
TMPDIR=/tmp
export PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=travel
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
export PATH=$ORACLE_HOME/OPatch:$ORACLE_HOME/bin:$DB_HOME/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/X11R6/lib
export NLS_LANG=American_America.ZHS16GBK
alias ss="sqlplus / as sysdba"
[oracle@travel admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.3/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.58.66)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = bb)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.3/dbhome_1)
(SID_NAME = bb)
)
(SID_DESC =
(GLOBAL_DBNAME = travel)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.3/dbhome_1)
(SID_NAME = travel)
)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
[oracle@travel admin]$
bb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.66)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bb)
(SID_NAME = bb)
)
)
lunar =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.99)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = lunar)
(SID_NAME = lunar)
)
)
travel =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.66)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = travel)
(SID_NAME = travel)
)
)
重启监听
测试连接:
sqlplus /nolog
connect sys/oracle@bb as sysdba
connect sys/oracle@travel as sysdba
[oracle@lunar admin]$ cd $ORACLE_HOME/dbs
[oracle@lunar dbs]$ ls
10o0goff_1_1 11o0gogi_1_1 hc_bb.dat hc_travel.dat init.ora lkBB orapwbb snapcf_bb.f spfilebb.ora
[oracle@lunar dbs]$ cp orapwbb orapwtravel
[oracle@lunar dbs]$
[oracle@lunar ~]$ . bb.env
[oracle@lunar ~]$ env|grep ORA
ORACLE_SID=bb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
[oracle@lunar ~]$
[oracle@lunar ~]$ ss
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 28 00:45:21 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter database backup controlfile to trace as '/test/clonedb/ctl.bak';
Database altered.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@lunar ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jan 28 00:48:36 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BB (DBID=2078073270)
RMAN> backup database include current controlfile plus archivelog format='/test/clonedb/%U.bak';
Starting backup at 28-JAN-13
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=25 RECID=1 STAMP=805770987
input archived log thread=1 sequence=26 RECID=2 STAMP=805772602
input archived log thread=1 sequence=27 RECID=4 STAMP=805772819
input archived log thread=1 sequence=28 RECID=5 STAMP=805772821
input archived log thread=1 sequence=29 RECID=6 STAMP=805772824
input archived log thread=1 sequence=30 RECID=10 STAMP=805774399
input archived log thread=1 sequence=31 RECID=12 STAMP=805774399
input archived log thread=1 sequence=32 RECID=14 STAMP=805774400
input archived log thread=1 sequence=33 RECID=15 STAMP=805774400
input archived log thread=1 sequence=34 RECID=18 STAMP=805774405
input archived log thread=1 sequence=35 RECID=19 STAMP=805774405
input archived log thread=1 sequence=36 RECID=22 STAMP=805774408
input archived log thread=1 sequence=37 RECID=24 STAMP=805776104
input archived log thread=1 sequence=38 RECID=26 STAMP=805776106
input archived log thread=1 sequence=39 RECID=28 STAMP=805776322
input archived log thread=1 sequence=40 RECID=30 STAMP=805776507
input archived log thread=1 sequence=41 RECID=32 STAMP=805853616
input archived log thread=1 sequence=42 RECID=34 STAMP=805855723
channel ORA_DISK_1: starting piece 1 at 28-JAN-13
channel ORA_DISK_1: finished piece 1 at 28-JAN-13
piece handle=/test/clonedb/0vo0gofc_1_1.bak tag=TAG20130128T004843 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 28-JAN-13
Starting backup at 28-JAN-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/bb/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/bb/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/bb/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/bb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 28-JAN-13
channel ORA_DISK_1: finished piece 1 at 28-JAN-13
piece handle=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/10o0goff_1_1 tag=TAG20130128T004847 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 28-JAN-13
channel ORA_DISK_1: finished piece 1 at 28-JAN-13
piece handle=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/11o0gogi_1_1 tag=TAG20130128T004847 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 28-JAN-13
Starting backup at 28-JAN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=43 RECID=36 STAMP=805855765
channel ORA_DISK_1: starting piece 1 at 28-JAN-13
channel ORA_DISK_1: finished piece 1 at 28-JAN-13
piece handle=/test/clonedb/12o0gogl_1_1.bak tag=TAG20130128T004925 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 28-JAN-13
RMAN> exit
Recovery Manager complete.
[oracle@lunar ~]$
[oracle@lunar clonedb]$ . ~/travel.env
[oracle@lunar clonedb]$ ss
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 28 00:53:25 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile=/test/clonedb/pfiletravel.ora
ORACLE instance started.
Total System Global Area 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
SQL>
[oracle@lunar ~]$ . bb.env
[oracle@lunar ~]$ ss
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 28 01:03:35 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> connect sys/oracle@bb as sysdba
Connected.
SQL> connect sys/oracle@travel as sysdba
Connected.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@lunar ~]$ rman target sys/oracle@bb auxiliary sys/oracle@travel
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jan 28 01:06:33 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BB (DBID=2078073270)
connected to auxiliary database: TRAVEL (not mounted)
RMAN>
RMAN> run{
2> set newname for datafile 1 to '/test/clonedb/SYSTEM01.DBF';
3> set newname for datafile 2 to '/test/clonedb/undotbs01.DBF';
4> set newname for datafile 3 to '/test/clonedb/sysaux01.DBF';
5> set newname for datafile 4 to '/test/clonedb/users01.DBF';
6> duplicate target database to travel logfile
7> '/test/clonedb/redo01.log' size 10m,
8> '/test/clonedb/redo02.log' size 10m,
9> '/test/clonedb/redo03.log' size 10m;
10> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting Duplicate Db at 28-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=134 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 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''BB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''TRAVEL'' 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 = ''BB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''TRAVEL'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
Starting restore at 28-JAN-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=133 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 /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/11o0gogi_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/11o0gogi_1_1 tag=TAG20130128T004847
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/travel/control01.ctl
Finished restore at 28-JAN-13
database mounted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/28/2013 01:08:06
RMAN-05501: aborting duplication of target database
RMAN-05517: tempfile /u01/app/oracle/oradata/bb/temp01.dbf conflicts with file used by target database
RMAN>
[oracle@lunar clonedb]$ cd /u01/app/oracle/oradata/travel/
[oracle@lunar travel]$ ls -lrt
total 9824
-rw-r----- 1 oracle oinstall 10043392 Jan 28 01:16 control01.ctl
[oracle@lunar travel]$
[oracle@lunar travel]$ rm /u01/app/oracle/oradata/travel/control01.ctl
[oracle@lunar travel]$ ls /u01/app/oracle/oradata/travel
[oracle@lunar travel]$
[oracle@lunar travel]$ . ~/travel.env
[oracle@lunar travel]$ ss
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 28 01:21:58 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile=/test/clonedb/pfiletravel.ora
ORACLE instance started.
Total System Global Area 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@lunar travel]$
rman target sys/oracle@bb auxiliary sys/oracle@travel
run{
set newname for datafile 1 to '/test/clonedb/SYSTEM01.DBF';
set newname for datafile 2 to '/test/clonedb/undotbs01.DBF';
set newname for datafile 3 to '/test/clonedb/sysaux01.DBF';
set newname for datafile 4 to '/test/clonedb/users01.DBF';
set newname for datafile 5 to '/test/clonedb/temp01.DBF';
duplicate target database to travel nofilenamecheck logfile
'/test/clonedb/redo01.log' size 10m,
'/test/clonedb/redo02.log' size 10m,
'/test/clonedb/redo03.log' size 10m;
}
[oracle@lunar travel]$ ss
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 28 01:36:38 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown abort
ORACLE instance shut down.
SQL> !rm /u01/app/oracle/oradata/travel/control01.ctl
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@lunar travel]$ ss
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 28 01:36:58 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile=/test/clonedb/pfiletravel.ora
ORACLE instance started.
Total System Global Area 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@lunar travel]$ rman target sys/oracle@bb auxiliary sys/oracle@travel
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jan 28 01:37:25 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BB (DBID=2078073270)
connected to auxiliary database: TRAVEL (not mounted)
RMAN> run{
2> set newname for datafile 1 to '/test/clonedb/SYSTEM01.DBF';
3> set newname for datafile 2 to '/test/clonedb/undotbs01.DBF';
4> set newname for datafile 3 to '/test/clonedb/sysaux01.DBF';
5> set newname for datafile 4 to '/test/clonedb/users01.DBF';
6> set newname for datafile 5 to '/test/clonedb/temp01.DBF';
7> duplicate target database to travel nofilenamecheck logfile
8> '/test/clonedb/redo01.log' size 10m,
9> '/test/clonedb/redo02.log' size 10m,
10> '/test/clonedb/redo03.log' size 10m;
11> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting Duplicate Db at 28-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=134 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 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''BB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''TRAVEL'' 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 = ''BB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''TRAVEL'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
Starting restore at 28-JAN-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=133 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 /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/11o0gogi_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/11o0gogi_1_1 tag=TAG20130128T004847
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/travel/control01.ctl
Finished restore at 28-JAN-13
database mounted
contents of Memory Script:
{
set until scn 330514;
set newname for datafile 1 to
"/test/clonedb/SYSTEM01.DBF";
set newname for datafile 2 to
"/test/clonedb/undotbs01.DBF";
set newname for datafile 3 to
"/test/clonedb/sysaux01.DBF";
set newname for datafile 4 to
"/test/clonedb/users01.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
Starting restore at 28-JAN-13
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 /test/clonedb/SYSTEM01.DBF
channel ORA_AUX_DISK_1: restoring datafile 00002 to /test/clonedb/undotbs01.DBF
channel ORA_AUX_DISK_1: restoring datafile 00003 to /test/clonedb/sysaux01.DBF
channel ORA_AUX_DISK_1: restoring datafile 00004 to /test/clonedb/users01.DBF
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/10o0goff_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/10o0goff_1_1 tag=TAG20130128T004847
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 28-JAN-13
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=11 STAMP=805858730 file name=/test/clonedb/SYSTEM01.DBF
datafile 2 switched to datafile copy
input datafile copy RECID=12 STAMP=805858730 file name=/test/clonedb/undotbs01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=13 STAMP=805858730 file name=/test/clonedb/sysaux01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=14 STAMP=805858730 file name=/test/clonedb/users01.DBF
contents of Memory Script:
{
set until scn 330514;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 28-JAN-13
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 43 is already on disk as file /u01/archive/1_43_805707062.dbf
archived log file name=/u01/archive/1_43_805707062.dbf thread=1 sequence=43
media recovery complete, elapsed time: 00:00:00
Finished recover at 28-JAN-13
Oracle instance started
Total System Global Area 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''TRAVEL'' 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
sql statement: alter system set db_name = ''TRAVEL'' 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 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TRAVEL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/test/clonedb/redo01.log' SIZE 10 M ,
GROUP 2 '/test/clonedb/redo02.log' SIZE 10 M ,
GROUP 3 '/test/clonedb/redo03.log' SIZE 10 M
DATAFILE
'/test/clonedb/SYSTEM01.DBF'
CHARACTER SET AL32UTF8
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/bb/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/test/clonedb/undotbs01.DBF",
"/test/clonedb/sysaux01.DBF",
"/test/clonedb/users01.DBF";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/bb/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/test/clonedb/undotbs01.DBF RECID=1 STAMP=805858744
cataloged datafile copy
datafile copy file name=/test/clonedb/sysaux01.DBF RECID=2 STAMP=805858744
cataloged datafile copy
datafile copy file name=/test/clonedb/users01.DBF RECID=3 STAMP=805858744
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=805858744 file name=/test/clonedb/undotbs01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=805858744 file name=/test/clonedb/sysaux01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=805858744 file name=/test/clonedb/users01.DBF
Reenabling controlfile options for auxiliary database
Executing: alter database add supplemental log data
Executing: alter database force logging
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 28-JAN-13
RMAN>
[oracle@lunar travel]$ . ~/travel.env
[oracle@lunar travel]$ ss
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 28 01:40:32 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> select NAME,OPEN_MODE from v$database;
NAME OPEN_MODE
------------------ ----------------------------------------
TRAVEL READ WRITE
SQL>
SQL> show parameter instance_name
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
instance_name string
travel
SQL> !
[oracle@lunar ~]$ ls -lrt /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/spfiletravel.ora
ls: /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/spfiletravel.ora: No such file or directory
[oracle@lunar ~]$ exit
exit
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup pfile=/test/clonedb/pfiletravel.ora
ORACLE instance started.
Total System Global Area 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
Database mounted.
Database opened.
SQL> create spfile from pfile='/test/clonedb/pfiletravel.ora';
File created.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 530288640 bytes
Fixed Size 2230024 bytes
Variable Size 163580152 bytes
Database Buffers 356515840 bytes
Redo Buffers 7962624 bytes
Database mounted.
Database opened.
SQL>