eygle.com   eygle.com
eygle.com  
 

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

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

作者:eygle |【转载时请务必以超链接形式标明文章和作者信息及本声明
链接:
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-

By eygle on 2007-11-20 16:14 | Comments (6) | Posted to Advanced | Edit |Pageviews:

相关文章 随机文章
  • Oracle10g OCR及Voting Disk的备份
  • What's Mean "reliable message"?
  • Oracle10.2.0.3 RAC的VIP及实例依赖关系
  • 学习VMware技术,从下载开始
  • RAC环境中关于系统时钟的调整
  • 瑞典游记-别章-丹麦哥本哈根游记 Part III
    Oracle支撑起世界最大人口身份信息数据库
    Oracle10gR2中一些新特性
    楠溪江之美
    王小慧作品
    网上相关主题:
    Google

    留言 (6)

    了解了

    Posted by: bosonmaster at November 20, 2007 5:26 PM

    学到了不少,
    谢谢!

    Posted by: xhy at November 21, 2007 8:36 AM

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

    Posted by: bulletming at November 21, 2007 11:00 AM

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

    Posted by: eygle at November 21, 2007 11:28 AM

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

    Posted by: 秦一 at November 22, 2007 12:47 AM

    this is a bug, and will be fixed in 11.1.0.7

    Posted by: ricky at December 2, 2007 1:03 PM

    发表留言:



    Remember Me?
    (输入验证码后方可评论,谢谢支持)



    CopyRight © 2004 eygle.com, All rights reserved.