标签:des com http blog style class div img code java size
一,创建所需目录
1)创建审计文件目录
PROD1@dbrac1 /dsg/oracle11$ cd $ORACLE_BASE/admin PROD1@dbrac1 /u01/app/oracle/admin$ mkdir -p PROD1/adump
2)创建数据文件目录
mkdir -p /dsg/oracle11/PROD1
二,创建参数文件和密码文件
这里,复制主库的参数文件和密码文件,参数文件稍作修改
PROD1@dbrac1 /dsg$ export ORACLE_SID=PROD PROD@dbrac1 /dsg$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 29 14:00:54 2014 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options SQL> create pfile from spfile; File created. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options PROD@dbrac1 /dsg$ cd $ORACLE_HOME/dbs PROD@dbrac1 /u01/app/oracle/product/11.2.0/dbs$ cp initPROD.ora initPROD1.ora #复制密码文件
PROD@dbrac1 /u01/app/oracle/product/11.2.0/dbs$ cp orapwPROD orapwPROD1
修改参数文件
PROD1.__db_cache_size=272629760 PROD1.__java_pool_size=4194304 PROD1.__large_pool_size=4194304 PROD1.__oracle_base=‘/u01/app/oracle‘#ORACLE_BASE set from environment PROD1.__pga_aggregate_target=3812622336 PROD1.__sga_target=536870912 PROD1.__shared_io_pool_size=0 PROD1.__shared_pool_size=243269632 PROD1.__streams_pool_size=0 *.audit_file_dest=‘/u01/app/oracle/admin/PROD1/adump‘ *.audit_trail=‘db‘ *.compatible=‘11.2.0.0.0‘ *.control_files=‘/dsg/oracle11/PROD1/control01.ctl‘,‘/dsg/oracle11/PROD1/control02.ctl‘ *.db_block_size=32768 *.DB_NAME=‘PROD1‘ ###如果辅助实例在同一台服务器上,DB_NAME不能相同 *.DB_UNIQUE_NAME=‘PROD1‘ *.diagnostic_dest=‘/u01/app/oracle‘ *.dispatchers=‘(PROTOCOL=TCP) (SERVICE=PROD1XDB)‘ *.LOG_ARCHIVE_FORMAT=‘log%t_%s_%r.arc‘ *.open_cursors=300 *.pga_aggregate_target=3809476608 *.processes=150 *.REMOTE_LOGIN_PASSWORDFILE=‘EXCLUSIVE‘ *.sga_target=536870912 *.STANDBY_FILE_MANAGEMENT=‘AUTO‘ *.undo_tablespace=‘UNDOTBS1‘ ###下面两个参数可选,但是推荐使用,如果不使用可以在rman的run块中指定恢复的目录 *.DB_FILE_NAME_CONVERT=‘/dsg/oracle11/PROD‘,‘/dsg/oracle11/PROD1‘ *.LOG_FILE_NAME_CONVERT=‘/dsg/oracle11/PROD‘,‘/dsg/oracle11/PROD1‘
三,配置监听及TNS
这里,使用静态监听
vi listener.ora (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.70)(PORT=1521)) (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME=PROD) (SERVICE_NAME = PROD) (SID_NAME=PROD) (ORACLE_HOME=/u01/app/oracle/product/11.2.0) (PRESPAWN_MAX=20) (PRESPAWN_LIST= (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1)) ) ) (SID_DESC= (GLOBAL_DBNAME=PROD1) (SERVICE_NAME = PROD1) (SID_NAME=PROD1) (ORACLE_HOME=/u01/app/oracle/product/11.2.0) (PRESPAWN_MAX=20) (PRESPAWN_LIST= (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1)) ) ) )
tnsnames.ora添加
PROD = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.70)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD) ) ) PROD1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.70)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD1) ) )
####重启监听
lsnrctl reload
确认,
PROD@dbrac1 /home/oracle$ tnsping prod TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 29-APR-2014 14:15:53 Copyright (c) 1997, 2009, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/11.2.0/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.70)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD))) OK (40 msec) PROD@dbrac1 /home/oracle$ tnsping prod1 TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 29-APR-2014 14:15:57 Copyright (c) 1997, 2009, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/11.2.0/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.70)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD1))) OK (0 msec) PROD@dbrac1 /home/oracle$ sqlplus sys/oracle@prod as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 29 14:16:10 2014 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options PROD@dbrac1 /home/oracle$ sqlplus sys/oracle@prod1 as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 29 14:16:16 2014 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL>
四,启动辅助实例
启动辅助实例到nomount模式,也只能启动到nomount,一定要使用spfile参数文件
PROD@dbrac1 /home/oracle$ export ORACLE_SID=PROD1
PROD1@dbrac1 /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 29 14:21:22 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 534462464 bytes
Fixed
Size
2215064 bytes
Variable
Size
251659112 bytes
Database
Buffers 272629760
bytes
Redo
Buffers
7958528 bytes
五,rman连接TARGET和AUXILLARY实例,采用全字符串连接
PROD1@dbrac1 /home/oracle$ rman target sys/oracle@PROD AUXILIARY sys/oracle@PROD1 Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 29 14:26:12 2014 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: PROD (DBID=251192667) connected to auxiliary database: PROD1 (not mounted) RMAN> DUPLICATE TARGET DATABASE TO PROD1 2> FROM ACTIVE DATABASE; #####解释:
FROM ACTIVE DATABASE
: TheDUPLICATE
will be created directly from the source datafile, without an additional backup step. Starting Duplicate Db at 29-APR-14 using target database control file instead of recovery catalog allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=192 device type=DISK contents of Memory Script: { sql clone "alter system set db_name = ‘‘PROD‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile"; sql clone "alter system set db_unique_name = ‘‘PROD1‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile"; shutdown clone immediate; startup clone force nomount backup as copy current controlfile auxiliary format ‘/dsg/oracle11/PROD1/control01.ctl‘; restore clone controlfile to ‘/dsg/oracle11/PROD1/control02.ctl‘ from ‘/dsg/oracle11/PROD1/control01.ctl‘; alter clone database mount; } executing Memory Script sql statement: alter system set db_name = ‘‘PROD‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile sql statement: alter system set db_unique_name = ‘‘PROD1‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile Oracle instance shut down Oracle instance started Total System Global Area 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes Starting backup at 29-APR-14 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=136 device type=DISK channel ORA_DISK_1: starting datafile copy copying current control file output file name=/u01/app/oracle/product/11.2.0/dbs/snapcf_PROD.f tag=TAG20140429T142805 RECID=5 STAMP=846167286 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 29-APR-14 Starting restore at 29-APR-14 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=192 device type=DISK channel ORA_AUX_DISK_1: copied control file copy Finished restore at 29-APR-14 database mounted contents of Memory Script: { set newname for datafile 1 to "/dsg/oracle11/PROD1/system01.dbf"; set newname for datafile 2 to "/dsg/oracle11/PROD1/sysaux01.dbf"; set newname for datafile 3 to "/dsg/oracle11/PROD1/undotbs01.dbf"; set newname for datafile 4 to "/dsg/oracle11/PROD1/users01.dbf"; backup as copy reuse datafile 1 auxiliary format "/dsg/oracle11/PROD1/system01.dbf" datafile 2 auxiliary format "/dsg/oracle11/PROD1/sysaux01.dbf" datafile 3 auxiliary format "/dsg/oracle11/PROD1/undotbs01.dbf" datafile 4 auxiliary format "/dsg/oracle11/PROD1/users01.dbf" ; sql ‘alter system archive log current‘; } executing Memory Script executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting backup at 29-APR-14 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile file number=00002 name=/dsg/oracle11/PROD/sysaux01.dbf output file name=/dsg/oracle11/PROD1/sysaux01.dbf tag=TAG20140429T142815 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:03:05 channel ORA_DISK_1: starting datafile copy input datafile file number=00001 name=/dsg/oracle11/PROD/system01.dbf output file name=/dsg/oracle11/PROD1/system01.dbf tag=TAG20140429T142815 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:55 channel ORA_DISK_1: starting datafile copy input datafile file number=00003 name=/dsg/oracle11/PROD/undotbs01.dbf output file name=/dsg/oracle11/PROD1/undotbs01.dbf tag=TAG20140429T142815 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=/dsg/oracle11/PROD/users01.dbf output file name=/dsg/oracle11/PROD1/users01.dbf tag=TAG20140429T142815 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 Finished backup at 29-APR-14 sql statement: alter system archive log current contents of Memory Script: { backup as copy reuse archivelog like "/dsg/oracle11/PROD/arch/log1_130_839354331.arc" auxiliary format "/u01/app/oracle/product/11.2.0/dbs/archlog1_130_839354331.arc" ; catalog clone archivelog "/u01/app/oracle/product/11.2.0/dbs/archlog1_130_839354331.arc"; switch clone datafile all; } executing Memory Script Starting backup at 29-APR-14 using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=130 RECID=89 STAMP=846167588 output file name=/u01/app/oracle/product/11.2.0/dbs/archlog1_130_839354331.arc RECID=0 STAMP=0 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03 Finished backup at 29-APR-14 cataloged archived log archived log file name=/u01/app/oracle/product/11.2.0/dbs/archlog1_130_839354331.arc RECID=88 STAMP=846167592 datafile 1 switched to datafile copy input datafile copy RECID=5 STAMP=846167592 file name=/dsg/oracle11/PROD1/system01.dbf datafile 2 switched to datafile copy input datafile copy RECID=6 STAMP=846167592 file name=/dsg/oracle11/PROD1/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=7 STAMP=846167592 file name=/dsg/oracle11/PROD1/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=8 STAMP=846167593 file name=/dsg/oracle11/PROD1/users01.dbf contents of Memory Script: { set until scn 2097725; recover clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 29-APR-14 using channel ORA_AUX_DISK_1 starting media recovery archived log for thread 1 with sequence 130 is already on disk as file /u01/app/oracle/product/11.2.0/dbs/archlog1_130_839354331.arc archived log file name=/u01/app/oracle/product/11.2.0/dbs/archlog1_130_839354331.arc thread=1 sequence=130 media recovery complete, elapsed time: 00:00:00 Finished recover at 29-APR-14 contents of Memory Script: { shutdown clone immediate; startup clone nomount; sql clone "alter system set db_name = ‘‘PROD1‘‘ 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 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes sql statement: alter system set db_name = ‘‘PROD1‘‘ 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 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes sql statement: CREATE CONTROLFILE REUSE SET DATABASE "PROD1" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 ( ‘/dsg/oracle11/PROD1/redo01.log‘ ) SIZE 50 M REUSE, GROUP 2 ( ‘/dsg/oracle11/PROD1/redo02.log‘ ) SIZE 50 M REUSE, GROUP 3 ( ‘/dsg/oracle11/PROD1/redo03.log‘ ) SIZE 50 M REUSE DATAFILE ‘/dsg/oracle11/PROD1/system01.dbf‘ CHARACTER SET ZHS16GBK contents of Memory Script: { set newname for tempfile 1 to "/dsg/oracle11/PROD1/temp01.dbf"; switch clone tempfile all; catalog clone datafilecopy "/dsg/oracle11/PROD1/sysaux01.dbf", "/dsg/oracle11/PROD1/undotbs01.dbf", "/dsg/oracle11/PROD1/users01.dbf"; switch clone datafile all; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to /dsg/oracle11/PROD1/temp01.dbf in control file cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/sysaux01.dbf RECID=1 STAMP=846167629 cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/undotbs01.dbf RECID=2 STAMP=846167630 cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/users01.dbf RECID=3 STAMP=846167630 datafile 2 switched to datafile copy input datafile copy RECID=1 STAMP=846167629 file name=/dsg/oracle11/PROD1/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=2 STAMP=846167630 file name=/dsg/oracle11/PROD1/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=3 STAMP=846167630 file name=/dsg/oracle11/PROD1/users01.dbf contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script database opened Finished Duplicate Db at 29-APR-14
###查看数据库状态 PROD1@dbrac1 /home/oracle$ export ORACLE_SID=PROD1 PROD1@dbrac1 /home/oracle$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 29 14:38:14 2014 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ PROD1 OPEN SQL> select open_mode from v$database; OPEN_MODE -------------------- READ WRITE
或者使用run块
清除掉环境变量
db_file_name_convert
log_file_name_convert
RUN { # The DUPLICATE command uses an automatic sbt channel. # Because the target datafiles are spread across multiple directories, # run SET NEWNAME rather than DB_FILE_NAME_CONVERT SET NEWNAME FOR DATAFILE 1 TO ‘/dsg/oracle11/PROD1/system01.dbf‘; SET NEWNAME FOR DATAFILE 2 TO ‘/dsg/oracle11/PROD1/sysaux01.dbf‘; SET NEWNAME FOR DATAFILE 3 TO ‘/dsg/oracle11/PROD1/undotbs01.dbf‘; SET NEWNAME FOR DATAFILE 4 TO ‘/dsg/oracle11/PROD1/users01.dbf‘; # Do not set a newname for datafile 7, because it is in the tools tablespace, # and you are excluding tools from the duplicate database. DUPLICATE TARGET DATABASE TO PROD1 FROM ACTIVE DATABASE LOGFILE GROUP 1 (‘/dsg/oracle11/PROD1/redo01a.log‘,‘/dsg/oracle11/PROD1/redo01b.log‘) SIZE 50M REUSE, GROUP 2 (‘/dsg/oracle11/PROD1/redo02a.log‘,‘/dsg/oracle11/PROD1/redo02b.log‘) SIZE 50M REUSE, GROUP 3 (‘/dsg/oracle11/PROD1/redo03a.log‘,‘/dsg/oracle11/PROD1/redo03b.log‘) SIZE 50M REUSE; }
SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ PROD1 OPEN SQL> select member from v$logfile; MEMBER -------------------------------------------------------------------------------- /dsg/oracle11/PROD1/redo03a.log /dsg/oracle11/PROD1/redo03b.log /dsg/oracle11/PROD1/redo02a.log /dsg/oracle11/PROD1/redo02b.log /dsg/oracle11/PROD1/redo01a.log /dsg/oracle11/PROD1/redo01b.log 6 rows selected.
或者 在rman中分配多通道
RUN { # The DUPLICATE command uses an automatic sbt channel. # Because the target datafiles are spread across multiple directories, #给源库分配通道 allocate channel prmy1 type disk; allocate channel prmy2 type disk; allocate channel prmy3 type disk; allocate channel prmy4 type disk; #给辅助实例分配通道 ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK; ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK; ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK; # run SET NEWNAME rather than DB_FILE_NAME_CONVERT SET NEWNAME FOR DATAFILE 1 TO ‘/dsg/oracle11/PROD1/system01.dbf‘; SET NEWNAME FOR DATAFILE 2 TO ‘/dsg/oracle11/PROD1/sysaux01.dbf‘; SET NEWNAME FOR DATAFILE 3 TO ‘/dsg/oracle11/PROD1/undotbs01.dbf‘; SET NEWNAME FOR DATAFILE 4 TO ‘/dsg/oracle11/PROD1/users01.dbf‘; SET NEWNAME FOR TEMPFILE 1 TO ‘/dsg/oracle11/PROD1/temp01.dbf‘; # Do not set a newname for datafile 7, because it is in the tools tablespace, # and you are excluding tools from the duplicate database. DUPLICATE TARGET DATABASE TO PROD1 FROM ACTIVE DATABASE LOGFILE GROUP 1 (‘/dsg/oracle11/PROD1/redo01a.log‘,‘/dsg/oracle11/PROD1/redo01b.log‘) SIZE 50M REUSE, GROUP 2 (‘/dsg/oracle11/PROD1/redo02a.log‘,‘/dsg/oracle11/PROD1/redo02b.log‘) SIZE 50M REUSE, GROUP 3 (‘/dsg/oracle11/PROD1/redo03a.log‘,‘/dsg/oracle11/PROD1/redo03b.log‘) SIZE 50M REUSE; }
恢复过程如下:
PROD1@dbrac1 /dsg/oracle11/PROD1$ rman target sys/oracle@PROD AUXILIARY sys/oracle@PROD1 Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 29 15:37:25 2014 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: PROD (DBID=251192667) connected to auxiliary database: PROD1 (not mounted) RMAN> RUN 2> { 3> # The DUPLICATE command uses an automatic sbt channel. 4> # Because the target datafiles are spread across multiple directories, 5> 6> allocate channel prmy1 type disk; 7> allocate channel prmy2 type disk; allocate channel prmy3 type disk; 9> allocate channel prmy4 type disk; 10> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK; ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK; ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK; 14> 15> # run SET NEWNAME rather than DB_FILE_NAME_CONVERT 16> SET NEWNAME FOR DATAFILE 1 TO ‘/dsg/oracle11/PROD1/system01.dbf‘; 17> SET NEWNAME FOR DATAFILE 2 TO ‘/dsg/oracle11/PROD1/sysaux01.dbf‘; 18> SET NEWNAME FOR DATAFILE 3 TO ‘/dsg/oracle11/PROD1/undotbs01.dbf‘; 19> SET NEWNAME FOR DATAFILE 4 TO ‘/dsg/oracle11/PROD1/users01.dbf‘; 20> SET NEWNAME FOR TEMPFILE 1 TO ‘/dsg/oracle11/PROD1/temp01.dbf‘; 21> # Do not set a newname for datafile 7, because it is in the tools tablespace, # and you are excluding tools from the duplicate database. 23> DUPLICATE TARGET DATABASE TO PROD1 FROM ACTIVE DATABASE 24> LOGFILE 25> GROUP 1 (‘/dsg/oracle11/PROD1/redo01a.log‘,‘/dsg/oracle11/PROD1/redo01b.log‘) SIZE 50M REUSE, 26> GROUP 2 (‘/dsg/oracle11/PROD1/redo02a.log‘,‘/dsg/oracle11/PROD1/redo02b.log‘) SIZE 50M REUSE, 27> GROUP 3 (‘/dsg/oracle11/PROD1/redo03a.log‘,‘/dsg/oracle11/PROD1/redo03b.log‘) SIZE 50M REUSE; 28> } using target database control file instead of recovery catalog allocated channel: prmy1 channel prmy1: SID=198 device type=DISK allocated channel: prmy2 channel prmy2: SID=13 device type=DISK allocated channel: prmy3 channel prmy3: SID=136 device type=DISK allocated channel: prmy4 channel prmy4: SID=201 device type=DISK allocated channel: aux1 channel aux1: SID=192 device type=DISK allocated channel: aux2 channel aux2: SID=6 device type=DISK allocated channel: aux3 channel aux3: SID=70 device type=DISK executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting Duplicate Db at 29-APR-14 contents of Memory Script: { sql clone "alter system set db_name = ‘‘PROD‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile"; sql clone "alter system set db_unique_name = ‘‘PROD1‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile"; shutdown clone immediate; startup clone force nomount backup as copy current controlfile auxiliary format ‘/dsg/oracle11/PROD1/control01.ctl‘; restore clone controlfile to ‘/dsg/oracle11/PROD1/control02.ctl‘ from ‘/dsg/oracle11/PROD1/control01.ctl‘; alter clone database mount; } executing Memory Script sql statement: alter system set db_name = ‘‘PROD‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile sql statement: alter system set db_unique_name = ‘‘PROD1‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile Oracle instance shut down Oracle instance started Total System Global Area 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes allocated channel: aux1 channel aux1: SID=192 device type=DISK allocated channel: aux2 channel aux2: SID=6 device type=DISK allocated channel: aux3 channel aux3: SID=69 device type=DISK Starting backup at 29-APR-14 channel prmy1: starting datafile copy copying current control file output file name=/u01/app/oracle/product/11.2.0/dbs/snapcf_PROD.f tag=TAG20140429T153754 RECID=8 STAMP=846171475 channel prmy1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 29-APR-14 Starting restore at 29-APR-14 channel aux2: skipped, AUTOBACKUP already found channel aux3: skipped, AUTOBACKUP already found channel aux1: copied control file copy Finished restore at 29-APR-14 database mounted contents of Memory Script: { set newname for datafile 1 to "/dsg/oracle11/PROD1/system01.dbf"; set newname for datafile 2 to "/dsg/oracle11/PROD1/sysaux01.dbf"; set newname for datafile 3 to "/dsg/oracle11/PROD1/undotbs01.dbf"; set newname for datafile 4 to "/dsg/oracle11/PROD1/users01.dbf"; backup as copy reuse datafile 1 auxiliary format "/dsg/oracle11/PROD1/system01.dbf" datafile 2 auxiliary format "/dsg/oracle11/PROD1/sysaux01.dbf" datafile 3 auxiliary format "/dsg/oracle11/PROD1/undotbs01.dbf" datafile 4 auxiliary format "/dsg/oracle11/PROD1/users01.dbf" ; sql ‘alter system archive log current‘; } executing Memory Script executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting backup at 29-APR-14 channel prmy1: starting datafile copy input datafile file number=00002 name=/dsg/oracle11/PROD/sysaux01.dbf channel prmy2: starting datafile copy input datafile file number=00001 name=/dsg/oracle11/PROD/system01.dbf channel prmy3: starting datafile copy input datafile file number=00003 name=/dsg/oracle11/PROD/undotbs01.dbf channel prmy4: starting datafile copy input datafile file number=00004 name=/dsg/oracle11/PROD/users01.dbf output file name=/dsg/oracle11/PROD1/system01.dbf tag=TAG20140429T153811 channel prmy2: datafile copy complete, elapsed time: 00:01:49 output file name=/dsg/oracle11/PROD1/undotbs01.dbf tag=TAG20140429T153811 channel prmy3: datafile copy complete, elapsed time: 00:01:49 output file name=/dsg/oracle11/PROD1/users01.dbf tag=TAG20140429T153811 channel prmy4: datafile copy complete, elapsed time: 00:01:48 output file name=/dsg/oracle11/PROD1/sysaux01.dbf tag=TAG20140429T153811 channel prmy1: datafile copy complete, elapsed time: 00:02:39 Finished backup at 29-APR-14 sql statement: alter system archive log current contents of Memory Script: { backup as copy reuse archivelog like "/dsg/oracle11/PROD/arch/log1_132_839354331.arc" auxiliary format "/u01/app/oracle/product/11.2.0/dbs/archlog1_132_839354331.arc" ; catalog clone archivelog "/u01/app/oracle/product/11.2.0/dbs/archlog1_132_839354331.arc"; switch clone datafile all; } executing Memory Script Starting backup at 29-APR-14 channel prmy1: starting archived log copy input archived log thread=1 sequence=132 RECID=93 STAMP=846171653 output file name=/u01/app/oracle/product/11.2.0/dbs/archlog1_132_839354331.arc RECID=0 STAMP=0 channel prmy1: archived log copy complete, elapsed time: 00:00:01 Finished backup at 29-APR-14 cataloged archived log archived log file name=/u01/app/oracle/product/11.2.0/dbs/archlog1_132_839354331.arc RECID=92 STAMP=846171655 datafile 1 switched to datafile copy input datafile copy RECID=8 STAMP=846171655 file name=/dsg/oracle11/PROD1/system01.dbf datafile 2 switched to datafile copy input datafile copy RECID=9 STAMP=846171655 file name=/dsg/oracle11/PROD1/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=10 STAMP=846171655 file name=/dsg/oracle11/PROD1/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=11 STAMP=846171655 file name=/dsg/oracle11/PROD1/users01.dbf contents of Memory Script: { set until scn 2102602; recover clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 29-APR-14 starting media recovery archived log for thread 1 with sequence 132 is already on disk as file /u01/app/oracle/product/11.2.0/dbs/archlog1_132_839354331.arc archived log file name=/u01/app/oracle/product/11.2.0/dbs/archlog1_132_839354331.arc thread=1 sequence=132 media recovery complete, elapsed time: 00:00:01 Finished recover at 29-APR-14 contents of Memory Script: { shutdown clone immediate; startup clone nomount; sql clone "alter system set db_name = ‘‘PROD1‘‘ 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 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes allocated channel: aux1 channel aux1: SID=192 device type=DISK allocated channel: aux2 channel aux2: SID=6 device type=DISK allocated channel: aux3 channel aux3: SID=69 device type=DISK sql statement: alter system set db_name = ‘‘PROD1‘‘ 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 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes allocated channel: aux1 channel aux1: SID=192 device type=DISK allocated channel: aux2 channel aux2: SID=6 device type=DISK allocated channel: aux3 channel aux3: SID=69 device type=DISK sql statement: CREATE CONTROLFILE REUSE SET DATABASE "PROD1" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 ( ‘/dsg/oracle11/PROD1/redo01a.log‘, ‘/dsg/oracle11/PROD1/redo01b.log‘ ) SIZE 50 M REUSE, GROUP 2 ( ‘/dsg/oracle11/PROD1/redo02a.log‘, ‘/dsg/oracle11/PROD1/redo02b.log‘ ) SIZE 50 M REUSE, GROUP 3 ( ‘/dsg/oracle11/PROD1/redo03a.log‘, ‘/dsg/oracle11/PROD1/redo03b.log‘ ) SIZE 50 M REUSE DATAFILE ‘/dsg/oracle11/PROD1/system01.dbf‘ CHARACTER SET ZHS16GBK contents of Memory Script: { set newname for tempfile 1 to "/dsg/oracle11/PROD1/temp01.dbf"; switch clone tempfile all; catalog clone datafilecopy "/dsg/oracle11/PROD1/sysaux01.dbf", "/dsg/oracle11/PROD1/undotbs01.dbf", "/dsg/oracle11/PROD1/users01.dbf"; switch clone datafile all; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to /dsg/oracle11/PROD1/temp01.dbf in control file cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/sysaux01.dbf RECID=1 STAMP=846171697 cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/undotbs01.dbf RECID=2 STAMP=846171697 cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/users01.dbf RECID=3 STAMP=846171697 datafile 2 switched to datafile copy input datafile copy RECID=1 STAMP=846171697 file name=/dsg/oracle11/PROD1/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=2 STAMP=846171697 file name=/dsg/oracle11/PROD1/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=3 STAMP=846171697 file name=/dsg/oracle11/PROD1/users01.dbf contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script database opened Finished Duplicate Db at 29-APR-14 released channel: prmy1 released channel: prmy2 released channel: prmy3 released channel: prmy4 released channel: aux1 released channel: aux2 released channel: aux3
六,总结及遇到的问题
1,在rman中恢复的时候总是报数据库名不一致,原来在同一个服务器上db_name不能相同且必须使用spfile
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 04/29/2014 15:21:38 RMAN-05520: database name mismatch, auxiliary instance has PROD, command specified PROD1
2,如果目标库与副本数据库的在线日志文件和数据文件路径不相同,则需要像本文一样配置db_file_name_convert和log_file_name_convert,否则会报错rman-06023
3,要是不配置db_file_name_convert和log_file_name_convert,可以通过如下命令达到相同的目的
RUN { # The DUPLICATE command uses an automatic sbt channel. # Because the target datafiles are spread across multiple directories, # run SET NEWNAME rather than DB_FILE_NAME_CONVERT SET NEWNAME FOR DATAFILE 1 TO ‘/oradata1/system01.dbf‘; SET NEWNAME FOR DATAFILE 2 TO ‘/oradata2/undotbs01.dbf‘; SET NEWNAME FOR DATAFILE 3 TO ‘/oradata3/cwmlite01.dbf‘; SET NEWNAME FOR DATAFILE 4 TO ‘/oradata4/drsys01‘; SET NEWNAME FOR DATAFILE 5 TO ‘/oradata5/example01.dbf‘; SET NEWNAME FOR DATAFILE 6 TO ‘/oradata6/indx01.dbf‘; # Do not set a newname for datafile 7, because it is in the tools tablespace, # and you are excluding tools from the duplicate database. SET NEWNAME FOR DATAFILE 8 TO ‘/oradata7/users01.dbf‘; DUPLICATE TARGET DATABASE TO dupdb SKIP TABLESPACE tools LOGFILE GROUP 1 (‘/duplogs/redo01a.log‘, ‘/duplogs/redo01b.log‘) SIZE 200K REUSE, GROUP 2 (‘/duplogs/redo02a.log‘, ‘/duplogs/redo02b.log‘) SIZE 200K REUSE; } 上面的命令还使用过SKIP TABLESPACE子句跳过指定表空间 另外还可以使用CONFIGURE AUXNAME 命令重命名数据文件,复制步骤如下: #configurethenewdesiredfilenames CONFIGURE AUXNAME FOR DATAFILE 1 TO ‘F:\oracle\oradata\jssdup\system01.dbf‘; CONFIGURE AUXNAME FOR DATAFILE 2 TO ‘F:\oracle\oradata\jssdup\undotbs01.dbf‘; #...addmoreCONFIGUREAUXNAMEcommandsasneeded 不过需要注意的是,duplicate执行完之后,推荐清除CONFIGUREAUXNAME。这样就不会对未来的 类似操作造成影响。 #clearspecifiedauxiliarynamesforthedatafiles CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR; CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR; 如果副本数据库与目标库不在同一台机器上,并且副本数据库的在线日志文件路径与目标库相同,NOFILENAMECHECK 则运行duplicate命令时必须指定NOFILENAMECHECK参数以避免冲突提示。此处oracle表现的很傻,它不知道你要恢复的路径是在另一台机器上,它只是认为要恢复到的路径怎么跟目标数据库表现的一样呢?会不会是要覆盖目标数据库啊,为了避免这种情形,于是它就报错。所以一旦异机恢复,并且路径相同,那么你必须通过指定NOFILENAMECHECK来避免oracle的自动识别。 这里NOFILENAMECHECK不是必须的
4)如果备份文件保存在磁盘上,分配的通道越多则速度越快,如果备份文件在磁带上,最少指定设备数量个通道。
七,使用备份恢复辅助实例
1)在同一服务器上
先备份数据库
backup database plus archivelog ;
然后恢复
RUN { # The DUPLICATE command uses an automatic sbt channel. # Because the target datafiles are spread across multiple directories, allocate channel prmy1 type disk; allocate channel prmy2 type disk; allocate channel prmy3 type disk; allocate channel prmy4 type disk; ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK; ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK; ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK; # run SET NEWNAME rather than DB_FILE_NAME_CONVERT SET NEWNAME FOR DATAFILE 1 TO ‘/dsg/oracle11/PROD1/system01.dbf‘; SET NEWNAME FOR DATAFILE 2 TO ‘/dsg/oracle11/PROD1/sysaux01.dbf‘; SET NEWNAME FOR DATAFILE 3 TO ‘/dsg/oracle11/PROD1/undotbs01.dbf‘; SET NEWNAME FOR DATAFILE 4 TO ‘/dsg/oracle11/PROD1/users01.dbf‘; SET NEWNAME FOR TEMPFILE 1 TO ‘/dsg/oracle11/PROD1/temp01.dbf‘; # Do not set a newname for datafile 7, because it is in the tools tablespace, # and you are excluding tools from the duplicate database. DUPLICATE TARGET DATABASE TO PROD1 LOGFILE GROUP 1 (‘/dsg/oracle11/PROD1/redo01a.log‘,‘/dsg/oracle11/PROD1/redo01b.log‘) SIZE 50M REUSE, GROUP 2 (‘/dsg/oracle11/PROD1/redo02a.log‘,‘/dsg/oracle11/PROD1/redo02b.log‘) SIZE 50M REUSE, GROUP 3 (‘/dsg/oracle11/PROD1/redo03a.log‘,‘/dsg/oracle11/PROD1/redo03b.log‘) SIZE 50M REUSE; }
说明:在使用DUPLICATE恢复数据库的时候使用的也是源数据库备份目录
PROD1@dbrac1 /dsg/oracle11/PROD1$ rman target sys/oracle@PROD AUXILIARY sys/oracle@PROD1 Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 29 16:54:02 2014 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: PROD (DBID=251192667) connected to auxiliary database: PROD1 (not mounted) RMAN> RUN 2> { # The DUPLICATE command uses an automatic sbt channel. 4> # Because the target datafiles are spread across multiple directories, 5> 6> allocate channel prmy1 type disk; 7> allocate channel prmy2 type disk; allocate channel prmy3 type disk; 9> allocate channel prmy4 type disk; 10> 11> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK; 12> ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK; 13> ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK; 14> 15> # run SET NEWNAME rather than DB_FILE_NAME_CONVERT 16> SET NEWNAME FOR DATAFILE 1 TO ‘/dsg/oracle11/PROD1/system01.dbf‘; 17> SET NEWNAME FOR DATAFILE 2 TO ‘/dsg/oracle11/PROD1/sysaux01.dbf‘; 18> SET NEWNAME FOR DATAFILE 3 TO ‘/dsg/oracle11/PROD1/undotbs01.dbf‘; 19> SET NEWNAME FOR DATAFILE 4 TO ‘/dsg/oracle11/PROD1/users01.dbf‘; 20> SET NEWNAME FOR TEMPFILE 1 TO ‘/dsg/oracle11/PROD1/temp01.dbf‘; # Do not set a newname for datafile 7, because it is in the tools tablespace, 22> # and you are excluding tools from the duplicate database. DUPLICATE TARGET DATABASE TO PROD1 LOGFILE GROUP 1 (‘/dsg/oracle11/PROD1/redo01a.log‘,‘/dsg/oracle11/PROD1/redo01b.log‘) SIZE 50M REUSE, GROUP 2 (‘/dsg/oracle11/PROD1/redo02a.log‘,‘/dsg/oracle11/PROD1/redo02b.log‘) SIZE 50M REUSE, GROUP 3 (‘/dsg/oracle11/PROD1/redo03a.log‘,‘/dsg/oracle11/PROD1/redo03b.log‘) SIZE 50M REUSE; } using target database control file instead of recovery catalog allocated channel: prmy1 channel prmy1: SID=73 device type=DISK allocated channel: prmy2 channel prmy2: SID=136 device type=DISK allocated channel: prmy3 channel prmy3: SID=201 device type=DISK allocated channel: prmy4 channel prmy4: SID=11 device type=DISK allocated channel: aux1 channel aux1: SID=192 device type=DISK allocated channel: aux2 channel aux2: SID=6 device type=DISK allocated channel: aux3 channel aux3: SID=70 device type=DISK executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting Duplicate Db at 29-APR-14 contents of Memory Script: { sql clone "alter system set db_name = ‘‘PROD‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile"; sql clone "alter system set db_unique_name = ‘‘PROD1‘‘ 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 = ‘‘PROD‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile sql statement: alter system set db_unique_name = ‘‘PROD1‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile Oracle instance shut down Oracle instance started Total System Global Area 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes allocated channel: aux1 channel aux1: SID=192 device type=DISK allocated channel: aux2 channel aux2: SID=6 device type=DISK allocated channel: aux3 channel aux3: SID=69 device type=DISK Starting restore at 29-APR-14 channel aux1: starting datafile backup set restore channel aux1: restoring control file channel aux1: reading from backup piece /u01/app/oracle/product/11.2.0/dbs/15p6v6sl_1_1 channel aux1: piece handle=/u01/app/oracle/product/11.2.0/dbs/15p6v6sl_1_1 tag=TAG20140429T163649 channel aux1: restored backup piece 1 channel aux1: restore complete, elapsed time: 00:00:03 output file name=/dsg/oracle11/PROD1/control01.ctl output file name=/dsg/oracle11/PROD1/control02.ctl Finished restore at 29-APR-14 database mounted contents of Memory Script: { set until scn 2106686; set newname for datafile 1 to "/dsg/oracle11/PROD1/system01.dbf"; set newname for datafile 2 to "/dsg/oracle11/PROD1/sysaux01.dbf"; set newname for datafile 3 to "/dsg/oracle11/PROD1/undotbs01.dbf"; set newname for datafile 4 to "/dsg/oracle11/PROD1/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 29-APR-14 channel aux1: starting datafile backup set restore channel aux1: specifying datafile(s) to restore from backup set channel aux1: restoring datafile 00001 to /dsg/oracle11/PROD1/system01.dbf channel aux1: restoring datafile 00002 to /dsg/oracle11/PROD1/sysaux01.dbf channel aux1: restoring datafile 00003 to /dsg/oracle11/PROD1/undotbs01.dbf channel aux1: restoring datafile 00004 to /dsg/oracle11/PROD1/users01.dbf channel aux1: reading from backup piece /u01/app/oracle/product/11.2.0/dbs/14p6v6p1_1_1 channel aux1: piece handle=/u01/app/oracle/product/11.2.0/dbs/14p6v6p1_1_1 tag=TAG20140429T163649 channel aux1: restored backup piece 1 channel aux1: restore complete, elapsed time: 00:01:55 Finished restore at 29-APR-14 contents of Memory Script: { switch clone datafile all; } executing Memory Script datafile 1 switched to datafile copy input datafile copy RECID=13 STAMP=846176193 file name=/dsg/oracle11/PROD1/system01.dbf datafile 2 switched to datafile copy input datafile copy RECID=14 STAMP=846176193 file name=/dsg/oracle11/PROD1/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=15 STAMP=846176194 file name=/dsg/oracle11/PROD1/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=16 STAMP=846176194 file name=/dsg/oracle11/PROD1/users01.dbf contents of Memory Script: { set until scn 2106686; recover clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 29-APR-14 starting media recovery archived log for thread 1 with sequence 134 is already on disk as file /dsg/oracle11/PROD/arch/log1_134_839354331.arc archived log file name=/dsg/oracle11/PROD/arch/log1_134_839354331.arc thread=1 sequence=134 media recovery complete, elapsed time: 00:00:01 Finished recover at 29-APR-14 contents of Memory Script: { shutdown clone immediate; startup clone nomount; sql clone "alter system set db_name = ‘‘PROD1‘‘ 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 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes allocated channel: aux1 channel aux1: SID=192 device type=DISK allocated channel: aux2 channel aux2: SID=6 device type=DISK allocated channel: aux3 channel aux3: SID=69 device type=DISK sql statement: alter system set db_name = ‘‘PROD1‘‘ 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 534462464 bytes Fixed Size 2215064 bytes Variable Size 251659112 bytes Database Buffers 272629760 bytes Redo Buffers 7958528 bytes allocated channel: aux1 channel aux1: SID=192 device type=DISK allocated channel: aux2 channel aux2: SID=6 device type=DISK allocated channel: aux3 channel aux3: SID=69 device type=DISK sql statement: CREATE CONTROLFILE REUSE SET DATABASE "PROD1" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 ( ‘/dsg/oracle11/PROD1/redo01a.log‘, ‘/dsg/oracle11/PROD1/redo01b.log‘ ) SIZE 50 M REUSE, GROUP 2 ( ‘/dsg/oracle11/PROD1/redo02a.log‘, ‘/dsg/oracle11/PROD1/redo02b.log‘ ) SIZE 50 M REUSE, GROUP 3 ( ‘/dsg/oracle11/PROD1/redo03a.log‘, ‘/dsg/oracle11/PROD1/redo03b.log‘ ) SIZE 50 M REUSE DATAFILE ‘/dsg/oracle11/PROD1/system01.dbf‘ CHARACTER SET ZHS16GBK contents of Memory Script: { set newname for tempfile 1 to "/dsg/oracle11/PROD1/temp01.dbf"; switch clone tempfile all; catalog clone datafilecopy "/dsg/oracle11/PROD1/sysaux01.dbf", "/dsg/oracle11/PROD1/undotbs01.dbf", "/dsg/oracle11/PROD1/users01.dbf"; switch clone datafile all; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to /dsg/oracle11/PROD1/temp01.dbf in control file cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/sysaux01.dbf RECID=1 STAMP=846176234 cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/undotbs01.dbf RECID=2 STAMP=846176234 cataloged datafile copy datafile copy file name=/dsg/oracle11/PROD1/users01.dbf RECID=3 STAMP=846176234 datafile 2 switched to datafile copy input datafile copy RECID=1 STAMP=846176234 file name=/dsg/oracle11/PROD1/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=2 STAMP=846176234 file name=/dsg/oracle11/PROD1/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=3 STAMP=846176234 file name=/dsg/oracle11/PROD1/users01.dbf contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script database opened Finished Duplicate Db at 29-APR-14 released channel: prmy1 released channel: prmy2 released channel: prmy3 released channel: prmy4 released channel: aux1 released channel: aux2 released channel: aux3
2)在不同的服务器
拷贝源数据库的备份集到和源数据库放置备份集相同的目录下,或者NFS挂载到相同的目录下再执行上面的操作
八,参考
11g 使用rman duplicate复制数据库,创建辅助实例,布布扣,bubuko.com
11g 使用rman duplicate复制数据库,创建辅助实例
标签:des com http blog style class div img code java size
原文地址:http://www.cnblogs.com/haoxiaoyu/p/3699431.html