17
增加ASM磁盘
1.日立划分完磁盘后,需要先扫描磁盘
(root 两个节点都执行)
cfgmgr -v 通过查看日期找到刚才增加的磁盘,而去查看磁盘的用户组和权限ls -l /dev/rhdisk*
2.修改磁盘权限
(root 两个节点都执行)
chown grid:asmadmin /dev/rhdisk125
chmod 660 /dev/rhdisk125
ls -l /dev/rhdisk*
3.修改磁盘共享属性
chdev -l hdisk400 -a reserve_policy=no_reserve
lsattr -El hdisk429|grep reser 查看属性是否变更成功
4.增加磁盘组
(grid 一个节点执行)
sqlplus / as sysasm
CREATE DISKGROUP DATADG_20141120 EXTERNAL REDUNDANCY DISK '/dev/rhdisk125' SIZE 409600M ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='1M';
*如asm的log日志报:ERROR: failed to update diskgroup resource ora.DATADG_20141120.dg错误,需要使用crsctl stat res -t查看ora.DATADG_20141120.dg状态,查询显示该磁盘组在本节点上是online,在另一个节点上是offline,此时登陆另一个节点(grid,sqlplus / as sysasm),执行alter diskgroup DATADG_20141120 mount;,再查询后状态正常。
5.磁盘组增加磁盘
(grid 一个节点执行)
sqlplus / as sysasm
ALTER DISKGROUP DATADG_20141120 ADD DISK '/dev/rhdisk126' SIZE 409600M;
(SIZE后面如果不写,应该默认的是整块磁盘)
完成后可用如下sql查看磁盘组状态
set linesize 148
col used format 9999.99
select b.name,sum(a.free_mb),sum(a.total_mb),round((sum(a.total_mb)-sum(a.free_mb))/sum(a.total_mb),2)*100
from v$asm_disk a,v$asm_diskgroup b
where a.group_number = b.group_number
group by a.group_number,b.name;
之后就可以使用该磁盘组空间了,如:
alter tablespace TBS_SERV_ALL add DATAFILE '+DATADG_20141120/tbs_serv_all_02.dbf'size 131070M;
6.删除和卸载磁盘组(在grid两个节点都要分别执行)
sqlplus / as sysasm
alter diskgroup DATADG_20141120 dismount;
drop diskgroup DATADG_20141120 force including contents;
查看ASM磁盘组有哪些磁盘组成
select name, path, group_number from v$asm_disk_stat where name like'DATADG_20170615%';
SELECT A.NAME G_NAME, B.NAME D_NAME,B.OS_MB,B.TOTAL_MB,B.FREE_MB,B.STATE, FAILGROUP, B.FAILGROUP_TYPE, PATH
FROM V$ASM_DISKGROUP A, V$ASM_DISK B
WHERE A.GROUP_NUMBER = B.GROUP_NUMBER
AND B.NAME LIKE 'DATAGROUP3%';
select group_number,name,total_mb/1024 total_gb,trunc(free_mb/1024) free_gb from v$asm_diskgroup;
alter tablespace TBS_DMD_02 add datafile '+DATADG_20171026/TBS_DMD_02_20171028_02.dbf' size 131070m autoextend off;
进入asm磁盘命令
登录grid 命令端 asmcmd