--ASM磁盘&磁盘组
--HEADER_STATUS含义
MEMBER 属于当前diskgroup的disk
FORMER 这个disk以前属于一个diskgroup,现在这个diskgroup被删除了
CANDIDATE 当使用裸设备,一个新的可以被diskgroup所用的disk
PROVISIONED 当使用asmlib,一个新的可以被diskgroup所用的disk(一般不用)
--查看磁盘信息
set linesize 333
col name for a15
col path for a35
SELECT PATH,HEADER_STATUS,TOTAL_MB,OS_MB,NAME FROM V$ASM_DISK ORDER BY NAME;
SELECT GROUP_NUMBER,DISK_NUMBER,MODE_STATUS,HEADER_STATUS,STATE,TOTAL_MB,FREE_MB,NAME,PATH FROM V$ASM_DISK;
--查看磁盘组大小
SELECT NAME,TOTAL_MB/1024,FREE_MB/1024 FROM V$ASM_DISKGROUP;
--查看ASM磁盘的冗余策略(HIGH/NOMORL/EXTEND)
SELECT GROUP_NUMBER,STATE,NAME,TYPE FROM V$ASM_DISKGROUP;
--查看备用(可用)磁盘
SELECT PATH,OS_MB,DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS STATE FROM V$ASM_DISK WHERE HEADER_STATUS='CANDIDATE';
--查看具体磁盘组中磁盘信息
SELECT GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,OS_MB,TOTAL_MB,FREE_MB,NAME FROM V$ASM_DISK WHERE GROUP_NUMBER=2;
SELECT GROUP_NUMBER,DISK_NUMBER,NAME,TOTAL_MB,FREE_MB,TOTAL_MB-FREE_MB USED_MB FROM V$ASM_DISK_STAT WHERE GROUP_NUMBER=2;
--查看具体磁盘信息(根据path信息)
SELECT GROUP_NUMBER,NAME,PATH,GROUP_NUMBER, DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE FROM V$ASM_DISK WHERE PATH IN ('/DEV/RDISK/DISK1718');
--查询磁盘组使用率
set linesize 333
col name for a15
col used_rate for a30
SELECT NAME,TOTAL_MB,FREE_MB,ROUND((TOTAL_MB-FREE_MB)/TOTAL_MB*100,2)||'%' USED_RATE FROM V$ASM_DISKGROUP ORDER BY 2 DESC;
--ASM磁盘组的分配与使用情况
col name for a12
select name,total_mb,free_mb from v$asm_disk;
select name,total_mb,free_mb from v$asm_diskgroup;
--删除磁盘
ALTER DISKGROUP DGDATA DROP DISK DISK_NAME;
SELECT GROUP_NUMBER,NAME,FAILGROUP,STATE,TOTAL_MB,FREE_MB,HEADER_STATUS FROM V$ASM_DISK;
--为DG1磁盘组取消正挂载的磁盘删除
ALTER DISKGROUP dg1 UNDROP DISKS;
--查看重平衡
SELECT * FROM V$ASM_OPERATION;
--调整rebalance速度(如果慢可以调)
alter diskgroup DGDATA rebalance power 10;
alter diskgroup DGDATA rebalance power 1;
--添加磁盘
ALTER DISKGROUP DGDATA ADD DISK '/dev/rdisk/disk1718';
--查看重平衡
SELECT * FROM V$ASM_OPERATION;
--查看磁盘信息
set linesize 333
col name for a15
col path for a20
SELECT GROUP_NUMBER,DISK_NUMBER,MODE_STATUS,HEADER_STATUS,STATE,TOTAL_MB,FREE_MB,NAME,PATH FROM V$ASM_DISK;
--添加完磁盘之后,oracle会自动做重平衡rebalance操作,可以通过视图查看
--重平衡进程
ps -ef|grep asmb
--查看重平衡
--SOFAR:就是目前为止挪动的AU数量1593
--EST_WORK:估计要挪动的AU数量1601
SELECT * FROM V$ASM_OPERATION;
--手动执行重平衡
ALTER DISKGROUP DGDATA REBALANCE POWER 8;
--查看POWER默认
SHOW PARAMETER ASM_POWER_LIMIT
--调整POWER
--如果存储比较高端,可以将这个值设置大一点(power取值0-11),power=0就是停止rebalance操作。
ALTER DISKGROUP DGDATA REBALANCE POWER 11;