对于 ASM,每个磁盘的的大小限制是 2T。 对于外部冗余的磁盘组,数据在磁盘组层面是没有冗余的。如果已经存在一个500g的磁盘,那么在增加一块2T的磁盘的话,这个磁盘组的容量就是2.5T.
另外,关于ASM的限制,你可以查看以下的联机文档。
Oracle® Automatic Storage Management Administrator's Guide
====> 4 Administering Oracle ASM Disk Groups
====> Performance and Scalability Considerations for Disk Groups
===>Oracle ASM Storage Limits
Oracle ASM provides near unlimited capacity for future growth, but does have some
storage limits. For example, Oracle ASM has the following limits on the number of
disk groups, disks, and files:
■ 63 disk groups in a storage system
■ 10,000 Oracle ASM disks in a storage system
■ 1 million files for each disk group
Without any Oracle Exadata Storage, Oracle ASM has these storage limits:
■ 2 terabytes (TB) maximum storage for each Oracle ASM disk <<<<<<<<<<<<<<<<<<<<<<<<<
■ 20 petabytes (PB) maximum for the storage system
With all Oracle Exadata Storage, Oracle ASM has these storage limits:
■ 4 PB maximum storage for each Oracle ASM disk
■ 40 exabytes (EB) maximum for the storage system
1. 磁盘大小<=2TB 是可以的,但是 磁盘大小>2TB就有问题,所以加入一个正好是2TB的disk没有问题。
2. 在10g有一种情况,比如,diskgroup中有2个asm disk,disk1是500GB,disk2是2TB,当disk1的500GB空间全部被使用,而disk2还有free空间时,asm会报空间不足的错误信息,导致disk2中大量free空间无法使用,这个是由于asm rebalance有问题导致的,这种情况下可以手动rebalance解决问题。在11.2没有这个问题了。
如果diskgroup中有2个disk,在使用的过程中ASM会自动去做rebalance,正常情况下不会有不均衡的情况。 如果实在是不均衡的话可以手动去rebalance。
如果时后添加了一个disk,那么asm也是自动去做rebalance。
ASM rebalance的过程我们可以做个testcase,比如diskgroup里面有一个disk#0 500MB,空间没有了,
然后我们加了一个1GB的disk#1,ASM 会自动完成这个rebalance,最终的结果是disk#1和diks2上面都有free空间,可以继续正常使用。
- create asm diskgroup
CREATE DISKGROUP dgdata3 EXTERNAL REDUNDANCY DISK 'ORCL:ASMDISK500M1'; <<< 只有一个盘
select group_number,disk_number,mount_status,header_status,mode_status,state,LABEL,path,total_mb, free_mb from v$asm_disk where group_number='2';
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATUS MODE_ST STATE LABEL PATH TOTAL_MB FREE_MB
------------ ----------- ------- --------------- ------- -------- ------------ -------------------- ---------- ----------
0 0 CLOSED FORMER ONLINE NORMAL ASMDISK1G1 ORCL:ASMDISK1G1 0 0
2 0 CACHED MEMBER ONLINE NORMAL ASMDISK500M1 ORCL:ASMDISK500M1 494 443
-create table
create tablespace tbs3 datafile '+dgdata3' size 440M autoextend on;
create table james.t3 tablespace tbs3 as select * from dba_objects;
SQL> /
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATUS MODE_ST STATE LABEL PATH TOTAL_MB FREE_MB
------------ ----------- ------- --------------- ------- -------- ------------ -------------------- ---------- ----------
0 0 CLOSED FORMER ONLINE NORMAL ASMDISK1G1 ORCL:ASMDISK1G1 0 0
2 0 CACHED MEMBER ONLINE NORMAL ASMDISK500M1 ORCL:ASMDISK500M1 494 1
<<
insert into james.t3 select * from james.t3;
BEGIN
DBMS_STATS.GATHER_TABLE_STATS (
ownname =>'JAMES',
tabname =>'T3',
estimate_percent=>50,
cascade =>true);
END;
/
SQL> select BLOCKS,blocks*8/1025 M from dba_tables where owner='JAMES' and TABLE_NAME in ('T3');
BLOCKS M
---------- ----------
54989 429.182439
SQL> insert into james.t3 select * from dba_objects;
insert into james.t3 select * from dba_objects
*
ERROR at line 1:
ORA-01653: unable to extend table JAMES.T3 by 1024 in tablespace TBS3
<<< 空间不足
SQL> /
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATUS MODE_ST STATE LABEL PATH TOTAL_MB FREE_MB
------------ ----------- ------- --------------- ------- -------- ------------ -------------------- ---------- ----------
0 0 CLOSED FORMER ONLINE NORMAL ASMDISK1G1 ORCL:ASMDISK1G1 0 0
2 0 CACHED MEMBER ONLINE NORMAL ASMDISK500M1 ORCL:ASMDISK500M1 494 1
<<< 空间不足
select 'ASM_DISK#'||disk_kffxp asmdisk_no,count(au_kffxp) total_au
from x$kffxp
where group_kffxp=2 and number_kffxp=256 and xnum_kffxp <> 2147483648
group by DISK_KFFXP;
ASMDISK_NO TOTAL_AU
------------------------------------------------- ----------
ASM_DISK#0 441 <<<< asm disk 0 has 441 AU
<<
-- add asm disk
alter diskgroup dgdata3 add disk 'ORCL:ASMDISK1G1'; 《《《添加一个asm disk 是1GB
--monitor rebalance
select * from v$asm_operation;
SQL> /
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
2 REBAL RUN 1 1 1 331 0
0
SQL> /
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
2 REBAL RUN 1 1 152 334 1020
0
<<< rebalance 在进行中。。
select group_number,disk_number,mount_status,header_status,mode_status,state,LABEL,path,total_mb, free_mb from v$asm_disk;
SQL> /
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATUS MODE_ST STATE LABEL PATH TOTAL_MB FREE_MB
------------ ----------- ------- --------------- ------- -------- ------------ -------------------- ---------- ----------
2 1 CACHED MEMBER ONLINE NORMAL ASMDISK1G1 ORCL:ASMDISK1G1 1019 985
2 0 CACHED MEMBER ONLINE NORMAL ASMDISK500M1 ORCL:ASMDISK500M1 494 33
SQL> /
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATUS MODE_ST STATE LABEL PATH TOTAL_MB FREE_MB
------------ ----------- ------- --------------- ------- -------- ------------ -------------------- ---------- ----------
2 1 CACHED MEMBER ONLINE NORMAL ASMDISK1G1 ORCL:ASMDISK1G1 1019 688
2 0 CACHED MEMBER ONLINE NORMAL ASMDISK500M1 ORCL:ASMDISK500M1 494 330
<<<< rebalance的过程中 asm disk0 的空间已经释放了,free_mb 是330MB了!
SQL> select 'ASM_DISK#'||disk_kffxp asmdisk_no,count(au_kffxp) total_au
2 from x$kffxp
3 where group_kffxp=2 and number_kffxp=256 and xnum_kffxp <> 2147483648
4 group by DISK_KFFXP;
SQL> /
ASMDISK_NO TOTAL_AU
------------------------------------------------- ----------
ASM_DISK#0 441
SQL> /
ASMDISK_NO TOTAL_AU
------------------------------------------------- ----------
ASM_DISK#0 284
ASM_DISK#1 157
SQL> /
ASMDISK_NO TOTAL_AU
------------------------------------------------- ----------
ASM_DISK#0 144
ASM_DISK#1 297
<<<< 只有disk#0时 全部的441 AU都分布在disk#0上,再添加disk#1后,一部分AU被rebalance到disk#1上,
最终ASM_DISK#0上有144个au,ASM_DISK#1 上有 297 au,差不多是2陪的关系。
-add another 500MB asm disk
alter diskgroup dgdata3 add disk 'ORCL:ASMDISK500M2';
- rebalance后的结果:
select group_number,disk_number,mount_status,header_status,mode_status,state,LABEL,path,total_mb, free_mb from v$asm_disk;
1 0 CACHED MEMBER ONLINE NORMAL ASMDISK500 ORCL:ASMDI 494 245
M1 SK500M1
1 1 CACHED MEMBER ONLINE NORMAL ASMDISK500 ORCL:ASMDI 494 248
M2 SK500M2
select 'ASM_DISK#'||disk_kffxp asmdisk_no,count(au_kffxp) total_au
from x$kffxp
where group_kffxp=1 and number_kffxp=256 and xnum_kffxp <> 2147483648
group by DISK_KFFXP;
ASMDISK_NO TOTAL_AU
------------------------------------------------- ----------
ASM_DISK#0 220
ASM_DISK#1 221
disk#0上的au会自动rebalance到新的disk#1上面,au个数基本相同。