eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« DBA警世录:where条件很重要 | Blog首页 | streams流复制中如何初始化复制对象 »

RAC + ASM单节点添加表空间的后果
modb.pro

RAC中如果加入的磁盘组只在一个ASM实例挂接,并且创建了表空间,会有什么状况发生呢?
也许实际总要比想像更复杂,我们看一下以下测试。
首先在B节点创建ASM磁盘组:
SQL> create diskgroup testdg external redundancy disk '/dev/rdsk/c2t0d3s6';

Diskgroup created.

SQL> select group_number,name,state,total_mb from v$asm_diskgroup;

GROUP_NUMBER NAME                          STATE        TOTAL_MB
------------ ------------------------------ ----------- ----------
          1 ORADG                          MOUNTED          16384
          2 TESTDG                        MOUNTED            927
创建完成之后TESTDG磁盘组自动被装载。

此时在节点A,TESTDG并未加载:
SQL> select group_number,name,state,total_mb from v$asm_diskgroup;

GROUP_NUMBER NAME                          STATE        TOTAL_MB
------------ ------------------------------ ----------- ----------
          1 ORADG                          MOUNTED          16384
          0 TESTDG                        DISMOUNTED          0

如果在此状态下,在B节点创建表空间及数据表:
SQL> create tablespace eygle datafile '+TESTDG' size 10M;

Tablespace created.

SQL> select group_number,name,state,total_mb from v$asm_diskgroup;

GROUP_NUMBER NAME                          STATE        TOTAL_MB
------------ ------------------------------ ----------- ----------
          1 ORADG                          CONNECTED        16384
          2 TESTDG                        CONNECTED          927

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+ORADG/eygle/datafile/system.256.581100367
+ORADG/eygle/datafile/undotbs1.258.581100367
+ORADG/eygle/datafile/sysaux.257.581100367
+ORADG/eygle/datafile/users.259.581100367
+ORADG/eygle/datafile/example.267.581100507
+ORADG/eygle/datafile/undotbs2.268.581100759
+TESTDG/eygle/datafile/eygle.256.581636009

7 rows selected.

SQL> create table eygle tablespace eygle as select * from dba_users;

Table created.

SQL> select count(*) from eygle;

  COUNT(*)
----------
        27

此时在A节点查询会遇到如下错误:
SQL> select count(*) from eygle;
select count(*) from eygle
                    *
ERROR at line 1:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '+TESTDG/eygle/datafile/eygle.256.581636009'

我们可以在ASM中挂接磁盘组:
SQL> alter diskgroup testdg mount;

Diskgroup altered.

但是你会发现在数据库中仍然无法访问数据表:

SQL> select count(*) from eygle;
select count(*) from eygle
                    *
ERROR at line 1:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '+TESTDG/eygle/datafile/eygle.256.581636009'

告警日志文件记录了如下错误信息:
Errors in file /opt/oracle/admin/eygle/bdump/eygle1_dbw0_6467.trc:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '+TESTDG/eygle/datafile/eygle.256.581636009'
ORA-17503: ksfdopn:2 Failed to open file +TESTDG/eygle/datafile/eygle.256.581636009
ORA-15001: diskgroup "TESTDG" does not exist or is not mounted
ORA-15001: diskgroup "TESTDG" does not exist or is not mounted
Sun Feb  5 21:33:32 2006
Errors in file /opt/oracle/admin/eygle/bdump/eygle1_dbw0_6467.trc:
ORA-01186: file 7 failed verification tests
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '+TESTDG/eygle/datafile/eygle.256.581636009'
Sun Feb  5 21:33:32 2006
File 7 not verified due to error ORA-01157
Sun Feb  5 21:33:32 2006
Errors in file /opt/oracle/admin/eygle/bdump/eygle1_dbw0_6467.trc:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '+TESTDG/eygle/datafile/eygle.256.581636009'
ORA-17503: ksfdopn:2 Failed to open file +TESTDG/eygle/datafile/eygle.256.581636009
ORA-15001: diskgroup "TESTDG" does not exist or is not mounted
ORA-15001: diskgroup "TESTDG" does not exist or is not mounted
Sun Feb  5 21:33:32 2006
Errors in file /opt/oracle/admin/eygle/bdump/eygle1_dbw0_6467.trc:
ORA-01186: file 7 failed verification tests
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '+TESTDG/eygle/datafile/eygle.256.581636009'
File 7 not verified due to error ORA-01157

实际上也就是说DBWR无法锁定该文件,只能重启实例予以解决。
bash-2.05$ export ORACLE_SID=eygle1
bash-2.05$ sqlplus "/ as sysdba" 

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 5 22:49:47 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters and Data Mining options

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size                  1978336 bytes
Variable Size            385880096 bytes
Database Buffers          855638016 bytes
Redo Buffers              14794752 bytes
Database mounted.
Database opened.
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+ORADG/eygle/datafile/system.256.581100367
+ORADG/eygle/datafile/undotbs1.258.581100367
+ORADG/eygle/datafile/sysaux.257.581100367
+ORADG/eygle/datafile/users.259.581100367
+ORADG/eygle/datafile/example.267.581100507
+ORADG/eygle/datafile/undotbs2.268.581100759
+TESTDG/eygle/datafile/eygle.256.581636009

7 rows selected.

SQL> select count(*) from eygle;

  COUNT(*)
----------
        27

所以我们在RAC环境下的种种操作一定要认真慎重,不能马虎草率,切记切记。

-The End-

历史上的今天...
    >> 2011-11-20文章:
    >> 2009-11-20文章:
    >> 2008-11-20文章:
    >> 2006-11-20文章:

By eygle on 2007-11-20 16:14 | Comments (6) | Advanced | 1676 |

6 Comments

学到了不少,
谢谢!

你的意思是在B节点创建万TESTDG后,就到A节点去mount起来就不会有问题呢?
还是说就不能在线增加DG,必须全部重启?

在线添加DG不用说吧,那肯定是可以的。

有时候在想,如果没有周密的规划,没有良好的工作习惯,没有严谨的工作态度。集群环境只会比单节点更加不稳定,对应用的影响更大。

this is a bug, and will be fixed in 11.1.0.7


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com