如何理解ASMFailureGroup
本篇文章给大家分享的是有关如何理解ASM Failure Group,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
创新互联长期为上1000家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为武穴企业提供专业的成都网站制作、成都网站建设,武穴网站改版等技术服务。拥有10年丰富建站经验和众多成功案例,为您定制开发。
用perl创建了两个RAW的1G文件,准备做failure group
SQL> select GROUP_NUMBER,DISK_NUMBER,INCARNATION,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE,REDUNDANCY,
2 TOTAL_MB,FREE_MB,NAME,FAILGROUP from v$asm_disk;
GROUP DISK MOUNT HEADER MODE TOTAL FREE
NUMBER NUMBER INCARNATION STATUS STATUS STATUS STATE REDUNDANC MB MB NAME FAILGROUP
------ ------ ----------- ------- --------- ------- ------ --------- ----- ----- ---------------- ----------------
0 0 0 CLOSED CANDIDATE ONLINE NORMAL UNKNOWN 1023 0
0 1 0 CLOSED CANDIDATE ONLINE NORMAL UNKNOWN 1023 0
1 0 4042421333 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2391 DISK_GROUP1_0000 DISK_GROUP1_0000
1 1 4042421334 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2399 DISK_GROUP1_0001 DISK_GROUP1_0001
2 0 4042421335 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2665 DISK_GROUP2_0000 DISK_GROUP2_0000
2 1 4042421336 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2668 DISK_GROUP2_0001 DISK_GROUP2_0001
已选择6行。
SQL> CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
2 FAILGROUP controller2 DISK 'D:\ASM DISK\DISK_FILE_DISK6' ;
CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15072: command requires at least 2 failure groups, discovered only 1
如果只有一个磁盘(failure group)是不可以做冗余策略(FAILURE GROUPS).
SQL> CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
2 FAILGROUP controller2 DISK 'D:\ASM DISK\DISK_FILE_DISK6'
3 FAILGROUP controller1 DISK 'D:\ASM DISK\DISK_FILE_DISK5' NAME disk5 SIZE 1023 M FORCE ;
CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15034: disk 'D:\ASM DISK\DISK_FILE_DISK5' does not require the FORCE option
因为磁盘5从来没有被ASM格式化过,所以不能用force选项,如果已经被ASM格式化过,就可以通过FORCE跳过格式化.
SQL> CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
2 FAILGROUP controller2 DISK 'D:\ASM DISK\DISK_FILE_DISK6'
3 FAILGROUP controller1 DISK 'D:\ASM DISK\DISK_FILE_DISK5' NAME disk5 SIZE 1023 M;
Diskgroup created.
磁盘组已经创建,faigroup分别命名controller1 ,controller2 .其中一个failgroup被命名为disk5
SQL> select GROUP_NUMBER,NAME,SECTOR_SIZE,BLOCK_SIZE,ALLOCATION_UNIT_SIZE,STATE,
2 TYPE,TOTAL_MB,FREE_MB,REQUIRED_MIRROR_FREE_MB,
3 USABLE_FILE_MB,OFFLINE_DISKS,UNBALANCED from v$asm_diskgroup;
REQUIRED USABLE
GROUP SECTOR BLOCK ALLOCATION TOTAL FREE MIRROR FILE
NUMBER NAME SIZE SIZE UNIT_SIZE STATE TYPE MB MB FREE_MB MB OFFLINE_DISKS UN
------ ------------ ------ ----- ---------- -------- ------ ----- ----- ---------- ---------- ------------- --
1 DISK_GROUP1 512 4096 1048576 MOUNTED EXTERN 6144 4790 0 4790 0 N
2 DISK_GROUP2 512 4096 1048576 MOUNTED EXTERN 6144 5333 0 5333 0 N
3 DISK_GROUP3 512 4096 1048576 MOUNTED NORMAL 2046 1944 0 972 0 N
可以看到磁盘组是normal类型
查看磁盘的状态和名称:
SQL> select GROUP_NUMBER,DISK_NUMBER,INCARNATION,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE,REDUNDANCY,
2 TOTAL_MB,FREE_MB,NAME,FAILGROUP from v$asm_disk;
GROUP DISK MOUNT HEADER MODE TOTAL FREE
NUMBER NUMBER INCARNATION STATUS STATUS STATUS STATE REDUNDANC MB MB NAME FAILGROUP
------ ------ ----------- ------- --------- ------- -------- --------- ----- ----- ---------------- ----------------
1 0 4042421333 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2391 DISK_GROUP1_0000 DISK_GROUP1_0000
1 1 4042421334 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2399 DISK_GROUP1_0001 DISK_GROUP1_0001
2 0 4042421335 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2665 DISK_GROUP2_0000 DISK_GROUP2_0000
2 1 4042421336 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2668 DISK_GROUP2_0001 DISK_GROUP2_0001
3 1 4042421348 CACHED MEMBER ONLINE NORMAL UNKNOWN 1023 972 DISK5 CONTROLLER1
3 0 4042421349 CACHED MEMBER ONLINE NORMAL UNKNOWN 1023 972 DISK_GROUP3_0000 CONTROLLER2
6 rows selected.
磁盘都是normal了
SQL> alter diskgroup disk_group3 dismount;
Diskgroup altered.
因为没有数据,可以在线dismount.
SQL> select state from v$asm_diskgroup where name='DISK_GROUP3';
STATE
------------------
DISMOUNTED
SQL> alter diskgroup disk_group3 mount;
Diskgroup altered.
SQL> alter diskgroup disk_group3 drop disk disk5;
磁盘组已变更。
删除一个磁盘,由于磁盘组要是normal的话,必须有两个磁盘,但是这个动作仍然可以完成.
SQL> select GROUP_NUMBER,DISK_NUMBER,INCARNATION,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE,REDUNDANCY,
2 TOTAL_MB,FREE_MB,NAME,FAILGROUP from v$asm_disk;
GROUP_NUMBER DISK_NUMBER INCARNATION MOUNT_STATUS HEADER_STATUS MODE_STATUS STATE REDUNDANCY
------------ ----------- ----------- -------------- ------------------------ -------------- ---------------- --------
1 0 4042862971 CACHED MEMBER ONLINE NORMAL UNKNOWN
1 1 4042862972 CACHED MEMBER ONLINE NORMAL UNKNOWN
2 0 4042862973 CACHED MEMBER ONLINE NORMAL UNKNOWN
2 1 4042862974 CACHED MEMBER ONLINE NORMAL UNKNOWN
3 1 4042862975 CACHED MEMBER ONLINE HUNG UNKNOWN
3 0 4042862976 CACHED MEMBER ONLINE NORMAL UNKNOWN
已选择6行。
我们看到这个磁盘是HUNG状态.
SQL> select * from v$asm_diskgroup;
GROUP_NUMBER NAME SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TYPE TOTAL_MB FREE_MB U COMP
------------ --------------- ----------- ---------- -------------------- ----------- ------ ---------- ---------- - ----
1 DISK_GROUP1 512 4096 1048576 CONNECTED EXTERN 6144 4790 N 10.1
2 DISK_GROUP2 512 4096 1048576 CONNECTED EXTERN 6144 5333 N 10.1
3 DISK_GROUP3 512 4096 1048576 CONNECTED NORMAL 2046 1936 N 10.1
SQL>
SQL> ALTER DISKGROUP DISK_GROUP3 CHECK DISK DISK5;
磁盘组已变更。
SQL> conn / as sysdba
已连接。
SQL> select file_name from dba_data_files;
FILE_NAME
---------------------------------------------------------------------------
+DISK_GROUP1/devdb/datafile/users.291.652996483
+DISK_GROUP1/devdb/datafile/sysaux.293.652996483
+DISK_GROUP1/devdb/datafile/undotbs1.292.652996483
+DISK_GROUP1/devdb/datafile/system.260.652996483
+DISK_GROUP1/devdb/datafile/example.256.652996665
D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\O1_MF_TEST2_42QWS6VO_.DBF
+DISK_GROUP3/devdb/datafile/teste.256.655147089
已选择8行。
SQL> create table scott.user_session_t as select * from v$session;
表已创建。
SQL> alter tablespace teste offline;
表空间已更改。
表空间offline以后,磁盘组卸载:
SQL> ALTER DISKGROUP DISK_GROUP3 DISMOUNT;
磁盘组已变更。
SQL> ALTER DISKGROUP DISK_GROUP3 MOUNT;
磁盘组已变更。
SQL> alter diskgroup disk_group3 rebalance power 2;
磁盘组已变更。
SQL> alter tablespace teste online;
表空间已更改。
SQL> alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 200m;
alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 200m
*
第 1 行出现错误:
ORA-01237: 无法扩展数据文件 8
ORA-01110: 数据文件 8: '+DISK_GROUP3/devdb/datafile/teste.256.655147089'
ORA-17505: ksfdrsz: 1 未能将文件大小调整为大小为 25600 的块
ORA-15041: diskgroup space exhausted
我们发现不能扩展数据文件
SQL> select GROUP_NUMBER,name,TOTAL_MB,FREE_MB,OFFLINE_DISKS,STATE from v$asm_diskgroup;
GROUP_NUMBER NAME TOTAL_MB FREE_MB OFFLINE_DISKS STATE
------------ ------------------------------ ---------- ---------- ------------- -----------
1 DISK_GROUP1 6144 4790 0 CONNECTED
2 DISK_GROUP2 6144 5333 0 CONNECTED
3 DISK_GROUP3 2046 1936 0 CONNECTED
空间是够的
SQL> alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 10m;
alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 10m
*
第 1 行出现错误:
ORA-01237: 无法扩展数据文件 8
ORA-01110: 数据文件 8: '+DISK_GROUP3/devdb/datafile/teste.256.655147089'
ORA-17505: ksfdrsz: 1 未能将文件大小调整为大小为 1280 的块
ORA-15041: diskgroup space exhausted
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1295152 bytes
Variable Size 57425104 bytes
ASM Cache 25165824 bytes
ASM 磁盘组已装载
SQL> alter diskgroup disk_group3 undrop disks;
磁盘组已变更。
这个时候,我们发现是可以取消这个删除动作
SQL> select * from v$asm_disk;
GROUP_NUMBER DISK_NUMBER COMPOUND_INDEX INCARNATION MOUNT_STATUS HEADER_STATUS MODE_STATUS STATE
------------ ----------- -------------- ----------- -------------- ------------------------ -------------- -------------
1 0 16777216 4041340299 CACHED MEMBER ONLINE NORMAL
1 1 16777217 4041340300 CACHED MEMBER ONLINE NORMAL
2 0 33554432 4041340301 CACHED MEMBER ONLINE NORMAL
2 1 33554433 4041340302 CACHED MEMBER ONLINE NORMAL
3 1 50331649 4041340303 CACHED MEMBER ONLINE NORMAL
3 0 50331648 4041340304 CACHED MEMBER ONLINE NORMAL
已选择6行。
SQL> alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 12m;
数据库已更改。
其实,我们做drop disk以后,并没有删除disk,我们看看hung状态的解释:
HUNG - Disk drop operation cannot continue because there is insufficient space to relocate the data from the disk being dropped
我们看到由于是failure group需要把数据转移到其他的failura group,而只有2个disk,所以这个数据并没有转移,而是停在那
以上就是如何理解ASM Failure Group,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。
分享标题:如何理解ASMFailureGroup
当前路径:http://azwzsj.com/article/popopp.html