正常情况下,在裸设备环境下的RAC中添加数据文件的步骤是:
1、在每个节点上划分或者规划新的分区,并用raw挂装上
2、在每个节点建立link符号链接,让数据库象访问文件系统那样访问裸设备
3、保证两个节点都完成以上操作,再在其中一个节点上创建数据文件
但是,如果以上操作不小心,可能发生一些烦人的意外,如执行步骤3的时候,应当首先在每个节点上先完成1,2,但是,如果1,2没有在每个节点执行成功,而仅仅是在创建数据文件的节点上执行成功,则其它的节点则会找不到新创建的数据文件。
这个时候的补救办法是什么呢?在没有找到数据文件的节点上:
1、赶紧用raw挂装上那个分区
2、对分区建立相应的对应的link
3、重新启动数据库?
如果不能重新启动数据库(如24*7的系统),怎么办呢?仅仅是执行以上的1,2步骤是不可以的,这样新的节点还是找不到新创建的数据文件,会报如下的错误:
Sun Aug 1 10:44:46 2004
Errors in file /opt/oracle/admin/tbdb2/bdump/tbdb 2in 2_dbw0_1564.trc:
ORA-01186: file 39 failed verification tests
ORA-01157: cannot identify/lock data file 39 - see DBWR trace file
ORA-01110: data file 39: '/opt/oracle/product/9.2/dbs/tbdb2/tbs_index2_2.dbf'
Sun Aug 1 10:44:46 2004
File 39 not verified due to error ORA-01157
Sun Aug 1 10:44:46 2004
Errors in file /opt/oracle/admin/tbdb2/bdump/tbdb 2in 2_dbw0_1564.trc:
ORA-01157: cannot identify/lock data file 39 - see DBWR trace file
ORA-01110: data file 39: '/opt/oracle/product/9.2/dbs/tbdb2/tbs_index2_2.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
怎么办呢?其实也不难,利用备份与恢复的办法,offline->recover datafile->online即可,如
rman>connect target
rman>run{
sql 'alter database datafile 39 offline';
recover datafile 39;
sql ''alter database datafile 39 online';
}
然后,我们就可以正常的访问该数据文件了,以上的执行步骤,在alert中将产生如下对应日志
Completed: alter database datafile 39 offline
Sun Aug 1 15:43:39 2004
Media Recovery Datafile: 39
Media Recovery Start
Starting datafile 39 recovery in thread 2 sequence 1201
Datafile 39: '/opt/oracle/product/9.2/dbs/tbdb2/tbs_index2_2.dbf'
Media Recovery Log
Recovery of Online Redo Log: Thread 2 Group 4 Seq 1201 Reading mem 0
Mem# 0 errs 0: /opt/oracle/product/9.2/dbs/tbdb2/redo_t2_11.log
Mem# 1 errs 0: /opt/oracle/product/9.2/dbs/tbdb2/redo_t2_12.log
Recovery of Online Redo Log: Thread 1 Group 2 Seq 1385 Reading mem 0
Mem# 0 errs 0: /opt/oracle/product/9.2/dbs/tbdb2/redo_t1_21.log
Mem# 1 errs 0: /opt/oracle/product/9.2/dbs/tbdb2/redo_t1_22.log
Recovery of Online Redo Log: Thread 1 Group 3 Seq 1386 Reading mem 0
Mem# 0 errs 0: /opt/oracle/product/9.2/dbs/tbdb2/redo_t1_31.log
Mem# 1 errs 0: /opt/oracle/product/9.2/dbs/tbdb2/redo_t1_32.log
Media Recovery Complete
Completed: alter database recover if needed
datafile 39
Sun Aug 1 15:46:30 2004
Thread 2 advanced to log sequence 1202
Current log# 5 seq# 1202 mem# 0: /opt/oracle/product/9.2/dbs/tbdb2/redo_t2_21.log
Current log# 5 seq# 1202 mem# 1: /opt/oracle/product/9.2/dbs/tbdb2/redo_t2_22.log
Sun Aug 1 15:47:10 2004
alter database datafile 39 online
Sun Aug 1 15:47:10 2004
Starting control autobackup
Control autobackup written to DISK device
handle '/netappdata1/rmanback/tbdb2/c-1413006996-20040801-05'
Completed: alter database datafile 39 online