Migrating from Oracle ASMLIB to ASM Filter Driver

Posted by ruiner17 on Fri, 19 Jul 2019 13:04:51 +0200

ASM Filter Driver is a new function that can replace ASMLIB and udev settings. It can replace ASMLIB and manual settings of udev rules files, and most importantly, I/O Filter functions. The so-called I/O Filter function can reject all invalid I/O requests. The main function is to prevent accidental overwriting of the underlying disk of the ASM disk. In the subsequent tests, we can see that the abnormal operation of dd total zeroing for root users can also be filtered.

1. Query cluster status

[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. Query Cluster Mode

[root@odb02 ~]# crsctl get cluster mode status
Cluster is running in "flex" mode

Since 12c R2, the default cluster mode is flex.

3. Query the current ASM disk and find the path

[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. Setting up a new ASM disk discovery path

[grid@odb02 ~]$ asmcmd dsset '/dev/oracleasm/disks/*','AFD:*'
[grid@odb02 ~]$ asmcmd  dsget
parameter:/dev/oracleasm/disks/*, AFD:*
profile:/dev/oracleasm/disks/*,AFD:*

5. Check nodes in GI environment

[grid@odb02 ~]$ olsnodes 
odb02
odb03

6. All RAC nodes stop cluster services

[root@odb02 ~]# crsctl stop crs
[root@odb03 ~]# crsctl stop crs

7. All RAC nodes uninstall ASMLIB software

  • odb02
    [root@odb02 ~]# systemctl disable oracleasm
    Removed symlink /etc/systemd/system/multi-user.target.wants/oracleasm.service.
    [root@odb02 ~]# oracleasm status
    Checking if ASM is loaded: yes
    Checking if /dev/oracleasm is mounted: yes
    [root@odb02 ~]# oracleasm exit
    Unmounting ASMlib driver filesystem: /dev/oracleasm
    Unloading module "oracleasm": oracleasm
    [root@odb02 ~]# ls -ltr /dev/oracleasm/
    total 0
    [root@odb02 ~]# yum -y remove oracleasm-support
  • odb03
    [root@odb03 ~]# systemctl disable oracleasm
    Removed symlink /etc/systemd/system/multi-user.target.wants/oracleasm.service.
    [root@odb03 ~]# oracleasm status
    Checking if ASM is loaded: yes
    Checking if /dev/oracleasm is mounted: yes
    [root@odb03 ~]# oracleasm exit
    Unmounting ASMlib driver filesystem: /dev/oracleasm
    Unloading module "oracleasm": oracleasm
    [root@odb03 ~]# ls -ltr /dev/oracleasm/
    total 0
    [root@odb03 ~]# yum -y remove oracleasm-support

    8. All RAC nodes stop acfsload service

    [root@odb02 ~]# lsmod|grep acfs
    [root@odb02 ~]# acfsload stop
    [root@odb02 ~]# lsmod|grep acfs

    9. All RAC nodes configure AFD

    AFD Configure, in fact, is a process of decompressing packages, installing and loading Driver s, which takes some time.

    [root@odb02 ~]# asmcmd afd_configure
    ASMCMD-9523: command cannot be used when Oracle Clusterware stack is up
    --If you encounter the above error, stop first has,Execute it again.
    [root@odb02 ~]# crsctl stop has
    [root@odb02 ~]# asmcmd afd_configure
    AFD-627: AFD distribution files found.
    AFD-634: Removing previous AFD installation.
    AFD-635: Previous AFD components successfully removed.
    AFD-636: Installing requested AFD software.
    AFD-637: Loading installed AFD drivers.
    AFD-9321: Creating udev for AFD.
    AFD-9323: Creating module dependencies - this may take some time.
    AFD-9154: Loading 'oracleafd.ko' driver.
    AFD-649: Verifying AFD devices.
    AFD-9156: Detecting control device '/dev/oracleafd/admin'.
    AFD-638: AFD installation correctness verified.
    Modifying resource dependencies - this may take some time.

    When the configuration is complete, verify the following status:

    [root@odb02 ~]# asmcmd afd_state
    ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'ENABLED' on host 'odb02'
    [root@odb03 ~]# asmcmd afd_state
    ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'ENABLED' on host 'odb03'
    --If the above state is disabled,Use the following command to enable
    [root@odb02 ~]# asmcmd afd_filter -e

    In addition, A / etc/oracleafd.conf file is generated, which reads as follows:

    [root@odb02 ~]# cat /etc/oracleafd.conf
    afd_diskstring='/dev/oracleasm/disks/*'

    If the other nodes do not, copy the file to avoid errors when starting crs.

    10. Migrate all ASM disks

    This one operates on one node. In other nodes, label is no longer needed, but scan directly, which is very similar to the operation using ASMLIB. In addition, the migrate parameter must be added after the command in order to succeed.

[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

Other nodes perform scanning operations:

[grid@odb03 ~]$ asmcmd afd_scan
[grid@odb03 ~]$ asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label                     Filtering   Path
================================================================================
DATA01                      ENABLED   /dev/sdb1
FRA001                      ENABLED   /dev/sdc1

Finally, update/etc/oracleafd.conf as follows:

[root@odb02 ~]# cat /etc/oracleafd.conf 
afd_diskstring='/dev/sd*

11. All RAC nodes start acfsload

[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. All RAC nodes start CRS

[root@odb02 ~]# crsctl start crs 
[root@odb03 ~]# crsctl start crs 

After all services are started, check the diskstring parameter settings:

[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

Finally, the following SQL is executed through SQLplus to verify:

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;

Reference:
1,Oracle ASM Filter Driver (ASMFD)
2,Migrating from ASMLIB to ASMFD

Topics: Database yum Oracle SQL sqlplus