ASM Filter Driver是一个可以取代 ASMLIB 和 udev 设置的新功能,它可以一举取代 ASMLIB 和手动设置 udev rules 文件的繁琐,并且最重要的是 I/O Filter 功能。所谓的I/O Filter功能可以拒绝所有无效的 I/O 请求,最主要的作用是防止意外覆写 ASM 磁盘的底层盘,在后面的测试中可以看到对于 root 用户的 dd 全盘清零这样的变态操作也都是可以过滤的。
1、查询集群状态
代码语言:javascript复制[root@odb02 ~]# crsctl check cluster -all
**************************************************************
odb02:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
odb03:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
2、查询集群模式
代码语言:javascript复制[root@odb02 ~]# crsctl get cluster mode status
Cluster is running in "flex" mode
从12c R2以后,默认的集群模式为flex。
3、查询当前的ASM磁盘以及发现路径
代码语言:javascript复制[root@odb02 ~]# Oracleasm listdisks | xargs oracleasm querydisk -p
Disk "DATA01" is a valid ASM disk
/dev/sdb1: LABEL="DATA01" TYPE="oracleasm"
Disk "FRA001" is a valid ASM disk
/dev/sdc1: LABEL="FRA001" TYPE="oracleasm"
[root@odb02 ~]# asmcmd dsget
parameter:/dev/oracleasm/disks/*
profile:/dev/oracleasm/disks/*
4、设置新的ASM磁盘发现路径
代码语言:javascript复制[grid@odb02 ~]$ asmcmd dsset '/dev/oracleasm/disks/*','AFD:*'
[grid@odb02 ~]$ asmcmd dsget
parameter:/dev/oracleasm/disks/*, AFD:*
profile:/dev/oracleasm/disks/*,AFD:*
5、检查 GI 环境中的节点
代码语言:javascript复制[grid@odb02 ~]$ olsnodes
odb02
odb03
6、RAC所有节点停止集群服务
代码语言:javascript复制[root@odb02 ~]# crsctl stop crs
[root@odb03 ~]# crsctl stop crs
7、RAC所有节点卸载ASMLIB软件
odb02
odb03
代码语言:javascript复制[root@odb02 ~]# asmcmd afd_label data01 /dev/sdb1 --migrate
[root@odb02 ~]# asmcmd afd_label fra001 /dev/sdc1 --migrate
[root@odb02 ~]# asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label Filtering Path
================================================================================
DATA01 ENABLED /dev/sdb1
FRA001 ENABLED /dev/sdc1
其他节点执行扫描操作:
代码语言:javascript复制[grid@odb03 ~]$ asmcmd afd_scan
[grid@odb03 ~]$ asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label Filtering Path
================================================================================
DATA01 ENABLED /dev/sdb1
FRA001 ENABLED /dev/sdc1
最后,更新/etc/oracleafd.conf的内容如下:
代码语言:javascript复制[root@odb02 ~]# cat /etc/oracleafd.conf
afd_diskstring='/dev/sd*
11、RAC所有节点启动acfsload
代码语言:javascript复制[root@odb02 ~]# acfsload start
ACFS-9391: Checking for existing ADVM/ACFS installation.
ACFS-9392: Validating ADVM/ACFS installation files for operating system.
ACFS-9393: Verifying ASM Administrator setup.
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9156: Detecting control device '/dev/asm/.asm_ctl_spec'.
ACFS-9156: Detecting control device '/dev/ofsctl'.
ACFS-9322: completed
12、RAC所有节点启动CRS
代码语言:javascript复制[root@odb02 ~]# crsctl start crs
[root@odb03 ~]# crsctl start crs
待所有服务启动后,检查下diskstring参数设置:
代码语言:javascript复制[grid@odb02 ~]$ asmcmd dsget
parameter:/dev/oracleasm/disks/*, AFD:*
profile:/dev/oracleasm/disks/*,AFD:*
[grid@odb02 ~]$ asmcmd dsset 'AFD:*'
[grid@odb02 ~]$ asmcmd dsget
parameter:AFD:*
profile:AFD:*
[grid@odb02 ~]$ asmcmd lsdsk
Path
AFD:DATA01
AFD:FRA001
最后通过SQLplus执行下面的SQL进行验证:
代码语言:javascript复制set linesize 300
col PATH for a20
set pages 20
col LIBRARY for a45
col NAME for a15
select inst_id,group_number grp_num,name,state,header_status header,mount_status mount,path, library
from gv$asm_disk order by inst_id,group_number,name;
参考文献: 1、Oracle ASM Filter Driver (ASMFD) 2、Migrating from ASMLIB to ASMFD