rac 简单归档设置下备份恢复理解

来源:互联网 发布:淘宝无法点击立即购买 编辑:程序博客网 时间:2024/05/16 01:17
理解最简单的备份方法,理解rman是如何备份与恢复的。
集群环境下对归档日志的备份注意事项:
必须保证备份实例上能够访问所有实例的归档日志,否则会报错,除非为各个实例分配通道。

集群环境下恢复注意事项:
进行restore时,为每个实例配置通道,以正确的转储。
进行recover时,当前操作实例必须能够访问所有的归档日志文件,否则可能恢复失败。

以上注意事项在任何归档日志设置情况下成立,只是有些情况下oracle为我们做了,或通过asm,或通过nfs,或其它方式。


以下以 最简单的归档日志设置 为例进行测试,
alter system set log_archive_dest_1='LOCATION=/oracle/rac1_arch' scope=spfile sid='RACDB1';
alter system set log_archive_dest_1='LOCATION=/oracle/rac2_arch' scope=spfile sid='RACDB2';

备份过程:

RACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 23:52:28 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368)RMAN> backup archivelog all tag='arc_bak' format='/oracle/backup/arch_%U_%T';Starting backup at 11-JAN-12current log archivedusing target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=152 instance=RACDB1 devtype=DISKRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of backup command at 01/11/2012 23:52:54RMAN-06059: expected archived log not found, lost of archived log compromises recoverabilityORA-19625: error identifying file /oracle/rac2_arch/2_11_771474603.dbfORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3RMAN> quitRecovery Manager complete.ORA-19625: error identifying file /oracle/rac2_arch/2_11_771474603.dbf 
ORA-19625: error identifying file /oracle/rac2_arch/2_11_771474603.dbf
找不到2_11_771474603.dbf 这个归档日志文件,因为在本地/oracle/rac2_arch/目录没有这个文件。这个文件在节点二的本地/oracle/rac2_arch/目录下,看下面:

RACDB1@rac1 /home/oracle$ ll /oracle/rac2_arch/total 0RACDB1@rac1 /home/oracle$ ssh rac2Last login: Wed Jan 11 23:50:52 2012 from rac1RACDB2@rac2 /home/oracle$ ll /oracle/rac1_arch/total 0RACDB2@rac2 /home/oracle$ ll /oracle/rac2_arch/total 132-rw-rw---- 1 oracle oinstall 95744 Jan 11 23:51 2_11_771474603.dbf   --就是无法找到这个日志文件-rw-rw---- 1 oracle oinstall 32768 Jan 11 23:52 2_12_771474603.dbf

采用connect的方法来分配通道,可以成功备份。

RACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jan 12 00:31:16 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368)RMAN>  run2>  {3>  allocate channel c1 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb1; allocate channel c2 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb2;5>  backup archivelog all tag='arc_bak' ;6>  release channel c1;7>  release channel c2;8>  }using target database control file instead of recovery catalogallocated channel: c1channel c1: sid=131 instance=RACDB1 devtype=DISKallocated channel: c2channel c2: sid=147 instance=RACDB2 devtype=DISKStarting backup at 12-JAN-12current log archived............piece handle=/oracle/backup/arch_08n0hm06_1_1_20120112 tag=ARC_BAK comment=NONEchannel c2: backup set complete, elapsed time: 00:00:03Finished backup at 12-JAN-12released channel: c1released channel: c2RMAN> quitRecovery Manager complete.--查看两个节点的备份结果RACDB1@rac1 /home/oracle$ ll /oracle/backup/total 159996-rw-r----- 1 oracle oinstall 123994112 Jan 12 00:31 arch_05n0hlvp_1_1_20120112-rw-r----- 1 oracle oinstall  39667712 Jan 12 00:32 arch_07n0hm05_1_1_20120112RACDB1@rac1 /home/oracle$ su rac2su: user rac2 does not existRACDB1@rac1 /home/oracle$ ssh rac2Last login: Thu Jan 12 00:27:36 2012 from rac1RACDB2@rac2 /home/oracle$ ll /oracle/backup/total 73252-rw-r----- 1 oracle oinstall 73526784 Jan 12 00:32 arch_06n0hlvp_1_1_20120112-rw-r----- 1 oracle oinstall  1399296 Jan 12 00:32 arch_08n0hm06_1_1_20120112

恢复过程:
 --全备数据库
 --分别在两个节点构造数据后,备份所有归档日志
 --关闭数据库后,在asmcmd下删除一数据文件
 --使用归档日志实施数据文件的恢复.(备份中没有对此数据文件的备份)
 
 归档日志设置:
 alter system set log_archive_dest_1='LOCATION=/oracle/rac1_arch' scope=spfile sid='RACDB1';
 alter system set log_archive_dest_1='LOCATION=/oracle/rac2_arch' scope=spfile sid='RACDB2';

--首先全备数据库BACKUP FORMAT '/oracle/backup/racdb_%U_%T' DATABASE TAG racdb_hot_db_bk; 
--两个节点构造数据 RACDB1@rac1 /home/oracle$ sqlplus lau/lau@racdb1SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 11 22:54:44 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsSQL> select name from v$datafile;NAME--------------------------------------------------------------------------------+DATA/racdb/datafile/system.256.771474531+DATA/racdb/datafile/undotbs1.258.771474533+DATA/racdb/datafile/sysaux.257.771474533+DATA/racdb/datafile/users.259.771474535+DATA/racdb/datafile/example.264.771474649+DATA/racdb/datafile/undotbs2.265.7714748256 rows selected.SQL> create tablespace test;Tablespace created.SQL> select name from v$datafile;NAME--------------------------------------------------------------------------------+DATA/racdb/datafile/system.256.771474531+DATA/racdb/datafile/undotbs1.258.771474533+DATA/racdb/datafile/sysaux.257.771474533+DATA/racdb/datafile/users.259.771474535+DATA/racdb/datafile/example.264.771474649+DATA/racdb/datafile/undotbs2.265.771474825+DATA/racdb/datafile/test.283.7723211197 rows selected.SQL> create table t(id int,text varchar2(10)) tablespace test;Table created.SQL> insert into t values(1,'hello');1 row created.SQL> commit;Commit complete.SQL> alter system switch logfile;System altered.SQL> quitDisconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsRACDB1@rac1 /home/oracle$ ssh rac2Last login: Wed Jan 11 21:29:25 2012 from rac1RACDB2@rac2 /home/oracle$ sqlplus lau/lau@racdb2SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 11 21:41:51 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsSQL> insert into t values(2,'world');1 row created.SQL> commit;Commit complete.SQL> alter system switch logfile;System altered.SQL> quitDisconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining options--查看两个节点的归档日志RACDB2@rac2 /home/oracle$ ll /oracle/rac2_arch/total 1052-rw-r----- 1 oracle oinstall 1070592 Jan 11 21:42 2_8_771474603.dbfRACDB2@rac2 /home/oracle$ ssh rac1Last login: Wed Jan 11 21:29:21 2012 from 192.168.246.1RACDB1@rac1 /home/oracle$ ll /oracle/rac1_arch/total 26876-rw-r----- 1 oracle oinstall 27486720 Jan 11 21:41 1_9_771474603.dbfRACDB1@rac1 /home/oracle$ ssh rac2Last login: Wed Jan 11 21:41:31 2012 from rac1RACDB2@rac2 /home/oracle$ ll /oracle/backup/total 0--全备归档日志RACDB2@rac2 /home/oracle$ ssh rac1Last login: Wed Jan 11 21:42:49 2012 from rac2RACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 21:43:47 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368)run { allocate channel c1 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb1; allocate channel c2 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb2; backup archivelog all delete all input; release channel c1; release channel c2;8>  }using target database control file instead of recovery catalogallocated channel: c1channel c1: sid=141 instance=RACDB1 devtype=DISKallocated channel: c2channel c2: sid=124 instance=RACDB2 devtype=DISKStarting backup at 11-JAN-12current log archived............channel c1: deleting archive log(s)archive log filename=/oracle/rac1_arch/1_9_771474603.dbf recid=15 stamp=772321287archive log filename=/oracle/rac1_arch/1_10_771474603.dbf recid=17 stamp=772321478Finished backup at 11-JAN-12released channel: c1released channel: c2RMAN> quitRecovery Manager complete.
--删除一数据文件ASMCMD> rm test.283.772321119ASMCMD> exit
+ASM1@rac1 /home/oracle$ export ORACLE_SID=RACDB1RACDB1@rac1 /home/oracle$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 11 21:57:01 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.Connected to an idle instance.--启动数据库,发现文件丢失SQL> startupORACLE instance started.Total System Global Area  167772160 bytesFixed Size                  1218316 bytesVariable Size              96471284 bytesDatabase Buffers           67108864 bytesRedo Buffers                2973696 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 7 - see DBWR trace fileORA-01110: data file 7: '+DATA/racdb/datafile/test.283.772321119'SQL> quit--登录rman,试图进行恢复RACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 21:57:37 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368, not open)RMAN> startup force mount;Oracle instance starteddatabase mountedTotal System Global Area     167772160 bytesFixed Size                     1218316 bytesVariable Size                 96471284 bytesDatabase Buffers              67108864 bytesRedo Buffers                   2973696 bytesRMAN> sql 'alter database datafile 7 offline';using target database control file instead of recovery catalogsql statement: alter database datafile 7 offlineRMAN> sql 'alter database open';sql statement: alter database openRMAN> restore datafile 7;Starting restore at 11-JAN-12allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=137 instance=RACDB1 devtype=DISKcreating datafile fno=7 name=+DATA/racdb/datafile/test.283.772321119restore not done; all files readonly, offline, or already restoredFinished restore at 11-JAN-12RMAN>  recover datafile 7;Starting recover at 11-JAN-12using channel ORA_DISK_1starting media recoverychannel ORA_DISK_1: starting archive log restore to default destinationchannel ORA_DISK_1: restoring archive logarchive log thread=2 sequence=8channel ORA_DISK_1: restoring archive logarchive log thread=2 sequence=9--看这步,无法读取 /oracle/backup/arch_05n0hc7c_1_1_20120111 归档日志文件channel ORA_DISK_1: reading from backup piece /oracle/backup/arch_05n0hc7c_1_1_20120111ORA-19870: error reading backup piece /oracle/backup/arch_05n0hc7c_1_1_20120111ORA-19505: failed to identify file "/oracle/backup/arch_05n0hc7c_1_1_20120111"ORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3channel ORA_DISK_1: starting archive log restore to default destinationchannel ORA_DISK_1: restoring archive logarchive log thread=1 sequence=9channel ORA_DISK_1: restoring archive logarchive log thread=1 sequence=10channel ORA_DISK_1: reading from backup piece /oracle/backup/arch_06n0hc7d_1_1_20120111channel ORA_DISK_1: restored backup piece 1piece handle=/oracle/backup/arch_06n0hc7d_1_1_20120111 tag=TAG20120111T214445channel ORA_DISK_1: restore complete, elapsed time: 00:00:25archive log filename=/oracle/rac1_arch/1_9_771474603.dbf thread=1 sequence=9RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 01/11/2012 22:00:48RMAN-20506: no backup of archivelog found--这里提示没有足够的归档日志文件 seq 9,seq 8RMAN-06053: unable to perform media recovery because of missing logRMAN-06025: no backup of log thread 2 seq 9 lowscn 822678 found to restoreRMAN-06025: no backup of log thread 2 seq 8 lowscn 791574 found to restoreRMAN> quitRecovery Manager complete.RACDB1@rac1 /home/oracle$ ll /oracle/rac1_arch/total 26956-rw-r----- 1 oracle oinstall    77824 Jan 11 22:00 1_10_771474603.dbf-rw-r----- 1 oracle oinstall 27486720 Jan 11 22:00 1_9_771474603.dbfRACDB1@rac1 /home/oracle$ ll /oracle/backup/total 825588-rw-r----- 1 oracle oinstall 146313728 Jan 11 21:45 arch_03n0hc6h_1_1_20120111-rw-r----- 1 oracle oinstall  27565568 Jan 11 21:45 arch_06n0hc7d_1_1_20120111-rw-r----- 1 oracle oinstall 655302656 Jan 11 21:36 racdb_01n0hbj8_1_1_20120111-rw-r----- 1 oracle oinstall  15368192 Jan 11 21:36 racdb_02n0hbn2_1_1_20120111RACDB1@rac1 /home/oracle$ ssh rac2Last login: Wed Jan 11 21:46:24 2012 from rac1--这里可以看出,节点二上的归档日志没有被restoreRACDB2@rac2 /home/oracle$ ll /oracle/rac2_arch/total 0RACDB2@rac2 /home/oracle$ ll /oracle/backup/total 28248-rw-r----- 1 oracle oinstall 27809280 Jan 11 21:45 arch_04n0hc6h_1_1_20120111-rw-r----- 1 oracle oinstall  1075712 Jan 11 21:45 arch_05n0hc7c_1_1_20120111RACDB2@rac2 /home/oracle$ ssh rac1Last login: Wed Jan 11 21:47:23 2012 from rac2RACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 22:06:55 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368)RMAN> run { allocate channel c1 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb1; allocate channel c2 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb2; restore datafile 7; recover datafile 7; sql 'alter database datafile 5 online';7>  }released channel: ORA_DISK_1allocated channel: c1channel c1: sid=152 instance=RACDB1 devtype=DISKreleased channel: c1RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================--提示通道2没有打开,应将节点二置于mount状态RMAN-12001: could not open channel c2RMAN-10008: could not create channel contextRMAN-10003: unable to connect to target databaseORA-12521: TNS:listener does not currently know of instance requested in connect descriptorRMAN> quitRecovery Manager complete.RACDB1@rac1 /home/oracle$ ssh rac2Last login: Wed Jan 11 22:04:07 2012 from rac1RACDB2@rac2 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 22:07:44 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database (not started)RMAN> startup mountOracle instance starteddatabase mountedTotal System Global Area     167772160 bytesFixed Size                     1218316 bytesVariable Size                 88082676 bytesDatabase Buffers              75497472 bytesRedo Buffers                   2973696 bytesRMAN> quitRecovery Manager complete.RACDB2@rac2 /home/oracle$ ssh rac1Last login: Wed Jan 11 22:06:50 2012 from rac2RACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 22:08:16 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368)run {2>  allocate channel c1 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb1;3>  allocate channel c2 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb2; restore datafile 7; recover datafile 7; sql 'alter database datafile 5 online';7>  }using target database control file instead of recovery catalogallocated channel: c1channel c1: sid=143 instance=RACDB1 devtype=DISKallocated channel: c2channel c2: sid=152 instance=RACDB2 devtype=DISKStarting restore at 11-JAN-12creating datafile fno=7 name=+DATA/racdb/datafile/test.283.772322367restore not done; all files readonly, offline, or already restoredFinished restore at 11-JAN-12Starting recover at 11-JAN-12starting media recoveryarchive log thread 1 sequence 9 is already on disk as file /oracle/rac1_arch/1_9_771474603.dbfarchive log thread 1 sequence 10 is already on disk as file /oracle/rac1_arch/1_10_771474603.dbfarchive log filename=/oracle/rac1_arch/1_9_771474603.dbf thread=1 sequence=9channel c2: starting archive log restore to default destinationchannel c2: restoring archive logarchive log thread=2 sequence=8channel c2: restoring archive logarchive log thread=2 sequence=9channel c2: reading from backup piece /oracle/backup/arch_05n0hc7c_1_1_20120111channel c2: restored backup piece 1piece handle=/oracle/backup/arch_05n0hc7c_1_1_20120111 tag=TAG20120111T214445channel c2: restore complete, elapsed time: 00:00:01archive log filename=/oracle/rac2_arch/2_8_771474603.dbf thread=2 sequence=8released channel: c1released channel: c2RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 01/11/2012 22:08:31RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/oracle/rac2_arch/2_8_771474603.dbf'--这里提示,在我们当前操作的节点,即节点一找不到 /oracle/rac2_arch/2_8_771474603.dbf 归档日志文件ORA-00308: cannot open archived log '/oracle/rac2_arch/2_8_771474603.dbf'ORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3RMAN> quitRecovery Manager complete.--查看两个节点可知,归档日志已经正确restore到指定的归档日志位置RACDB1@rac1 /home/oracle$ ll /oracle/rac1_arch/total 26956-rw-r----- 1 oracle oinstall    77824 Jan 11 22:00 1_10_771474603.dbf-rw-r----- 1 oracle oinstall 27486720 Jan 11 22:00 1_9_771474603.dbfRACDB1@rac1 /home/oracle$ ssh rac2Last login: Wed Jan 11 22:07:36 2012 from rac1RACDB2@rac2 /home/oracle$ ll /oracle/rac2_arch/total 1056-rw-r----- 1 oracle oinstall 1070592 Jan 11 22:08 2_8_771474603.dbf-rw-r----- 1 oracle oinstall    4096 Jan 11 22:08 2_9_771474603.dbfRACDB2@rac2 /home/oracle$ ssh rac1Last login: Wed Jan 11 22:08:13 2012 from rac2RACDB1@rac1 /home/oracle$ scp rac2:/oracle/rac2_arch/2_8_771474603.dbf  /oracle/rac1_arch/2_8_771474603.dbf                                                 100% 1046KB   1.0MB/s   00:00RACDB1@rac1 /home/oracle$ ll /oracle/rac1_arch/total 28008-rw-r----- 1 oracle oinstall    77824 Jan 11 22:00 1_10_771474603.dbf-rw-r----- 1 oracle oinstall 27486720 Jan 11 22:00 1_9_771474603.dbf-rw-r----- 1 oracle oinstall  1070592 Jan 11 22:15 2_8_771474603.dbfRACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 22:15:51 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368)RMAN>  run { allocate channel c1 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb1; allocate channel c2 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb2; recover datafile 7; --因为已经正确restore,这里只进行recover。5>  sql 'alter database datafile 7 online';6>  }released channel: ORA_DISK_1allocated channel: c1channel c1: sid=128 instance=RACDB1 devtype=DISKallocated channel: c2channel c2: sid=146 instance=RACDB2 devtype=DISKStarting recover at 11-JAN-12starting media recoveryarchive log thread 1 sequence 9 is already on disk as file /oracle/rac1_arch/1_9_771474603.dbfarchive log thread 1 sequence 10 is already on disk as file /oracle/rac1_arch/1_10_771474603.dbfarchive log filename=/oracle/rac1_arch/1_9_771474603.dbf thread=1 sequence=9channel c2: starting archive log restore to default destinationchannel c2: restoring archive logarchive log thread=2 sequence=8channel c2: restoring archive logarchive log thread=2 sequence=9channel c2: reading from backup piece /oracle/backup/arch_05n0hc7c_1_1_20120111channel c2: restored backup piece 1piece handle=/oracle/backup/arch_05n0hc7c_1_1_20120111 tag=TAG20120111T214445channel c2: restore complete, elapsed time: 00:00:01archive log filename=/oracle/rac2_arch/2_8_771474603.dbf thread=2 sequence=8released channel: c1released channel: c2RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 01/11/2012 22:18:03RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/oracle/rac2_arch/2_8_771474603.dbf'--在当前节点上依然找不到/oracle/rac2_arch/2_8_771474603.dbfORA-00308: cannot open archived log '/oracle/rac2_arch/2_8_771474603.dbf'ORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3RMAN> quitRecovery Manager complete.--在当前节点,即节点一,创建rac2_arch目录,并赋于oracle用户,并将缺失的/oracle/rac2_arch/2_8_771474603.dbf日志文件远程复制到节点一。RACDB1@rac1 /oracle$ suPassword:RACDB1@rac1 /oracle$ cd /oracle/RACDB1@rac1 /oracle$ mkdir rac2_archRACDB1@rac1 /oracle$ chown -R oracle.dba /oracle/rac2_arch/RACDB1@rac1 /oracle$ scp rac2:/oracle/rac2_arch/2_8_771474603.dbf  /oracle/rac2_arch/2_8_771474603.dbf                                                 100% 1046KB   1.0MB/s   00:00RACDB1@rac1 /oracle$ su - oracleRACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 22:21:23 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368) run {2>  allocate channel c2 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb2; allocate channel c1 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb1; allocate channel c2 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb2; recover datafile 7; sql 'alter database datafile 7 online';6>  }using target database control file instead of recovery catalogallocated channel: c1channel c1: sid=137 instance=RACDB1 devtype=DISKallocated channel: c2channel c2: sid=146 instance=RACDB2 devtype=DISKStarting recover at 11-JAN-12starting media recoveryarchive log thread 1 sequence 9 is already on disk as file /oracle/rac1_arch/1_9_771474603.dbfarchive log thread 1 sequence 10 is already on disk as file /oracle/rac1_arch/1_10_771474603.dbfarchive log filename=/oracle/rac1_arch/1_9_771474603.dbf thread=1 sequence=9channel c2: starting archive log restore to default destinationchannel c2: restoring archive logarchive log thread=2 sequence=8channel c2: restoring archive logarchive log thread=2 sequence=9channel c2: reading from backup piece /oracle/backup/arch_05n0hc7c_1_1_20120111channel c2: restored backup piece 1piece handle=/oracle/backup/arch_05n0hc7c_1_1_20120111 tag=TAG20120111T214445channel c2: restore complete, elapsed time: 00:00:01archive log filename=/oracle/rac2_arch/2_8_771474603.dbf thread=2 sequence=8released channel: c1released channel: c2RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 01/11/2012 22:21:42RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/oracle/rac2_arch/2_8_771474603.dbf'ORA-00308: cannot open archived log '/oracle/rac2_arch/2_8_771474603.dbf'ORA-27041: unable to open file--日志文件是使用root用户复制的,因此才没有权限Linux Error: 13: Permission deniedAdditional information: 2RMAN> quitRecovery Manager complete.--删除2_8_771474603.dbf后,使用oracle用户重新复制到节点1的rac2_arch目录下。RACDB1@rac1 /home/oracle$ suPassword:RACDB1@rac1 /home/oracle$ cd /oracle/rac2_arch/RACDB1@rac1 /oracle/rac2_arch$ lltotal 1052-rw-r----- 1 root root 1070592 Jan 11 22:21 2_8_771474603.dbfRACDB1@rac1 /oracle/rac2_arch$ rm *rm: remove regular file `2_8_771474603.dbf'? yRACDB1@rac1 /oracle/rac2_arch$ su - oracleRACDB1@rac1 /home/oracle$  scp rac2:/oracle/rac2_arch/2_8_771474603.dbf  /oracle/rac2_arch/2_8_771474603.dbf                                                 100% 1046KB   1.0MB/s   00:00--以下可知,已成功恢复。RACDB1@rac1 /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 11 22:23:07 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: RACDB (DBID=769091368) run { allocate channel c1 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb1;3>  allocate channel c2 device type disk format '/oracle/backup/arch_%U_%T' connect sys/oracle@racdb2;4>  recover datafile 7; sql 'alter database datafile 7 online';6>  }using target database control file instead of recovery catalogallocated channel: c1channel c1: sid=146 instance=RACDB1 devtype=DISKallocated channel: c2channel c2: sid=146 instance=RACDB2 devtype=DISKStarting recover at 11-JAN-12starting media recoveryarchive log thread 1 sequence 9 is already on disk as file /oracle/rac1_arch/1_9_771474603.dbfarchive log thread 1 sequence 10 is already on disk as file /oracle/rac1_arch/1_10_771474603.dbfarchive log thread 2 sequence 8 is already on disk as file /oracle/rac2_arch/2_8_771474603.dbfarchive log filename=/oracle/rac1_arch/1_9_771474603.dbf thread=1 sequence=9archive log filename=/oracle/rac2_arch/2_8_771474603.dbf thread=2 sequence=8media recovery complete, elapsed time: 00:00:05channel c2: starting archive log restore to default destinationchannel c2: restoring archive logarchive log thread=2 sequence=9channel c2: reading from backup piece /oracle/backup/arch_05n0hc7c_1_1_20120111channel c2: restored backup piece 1piece handle=/oracle/backup/arch_05n0hc7c_1_1_20120111 tag=TAG20120111T214445channel c2: restore complete, elapsed time: 00:00:01Finished recover at 11-JAN-12sql statement: alter database datafile 7 onlinereleased channel: c1released channel: c2RMAN> quitRecovery Manager complete.--验证恢复结果RACDB1@rac1 /home/oracle$ sqlplus lau/lau@racdb1SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 11 22:24:15 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsSQL> select * from t;        ID TEXT---------- ----------         1 hello         2 worldSQL>

原创粉丝点击