3 Configuring Oracle ASMLIB

WARNING:

Oracle Linux 7 is now in Extended Support. See Oracle Linux Extended Support and Oracle Open Source Support Policies for more information.

Migrate applications and data to Oracle Linux 8 or Oracle Linux 9 as soon as possible.

The following procedures are a guideline for the initial configuration of ASMLIB on Oracle Linux. See the following Oracle Database documentation for more information:

Important:

Changes to ASMLIB configuration don't take immediate effect. Stop the database and all related processes when reconfiguring ASMLIB. Changes usually take effect after the next system reboot.

Initializing ASMLIB Configuration

After installation, configure the ASMLIB software and scan for disks on boot by using the management utility, /usr/sbin/oracleasm.

You can read the ASMLIB configuration file at /etc/sysconfig/oracleasm, however we recommend that you always use oracleasm configure to change configuration parameters, so that this file is always correctly configured. The interactive (-i) option is typically used to configure the library for the first time.

  • Run the configuration utility in interactive mode to initialize the configuration.
    sudo oracleasm configure -i

    If run for the first time, the oracleasm configure utility asks a series of questions, including which user id and group id to assign permission to use ASMLIB.

    If the Oracle Database is configured to run as the oracle user and the dba group, the output looks similar to the following:

    Configuring the Oracle ASM library driver.
     
    This will configure the on-boot properties of the Oracle ASM library
    driver.  The following questions will determine whether the driver is
    loaded on boot and what permissions it will have.  The current values
    will be shown in brackets ('[]').  Hitting  without typing an
    answer will keep that current value.  Ctrl-C will abort.
    
    Default user to own the driver interface []: oracle
    Default group to own the driver interface []: dba
    Start Oracle ASM library driver on boot (y/n) [y]: y
    Scan for Oracle ASM disks on boot (y/n) [y]: y
    Writing Oracle ASM library driver configuration: done
  • Enable and start the oracleasm service.

    After you have finished configuring ASMLIB, enable and start the oracleasm service.

    sudo systemctl enable --now oracleasm

Making Disks Available to ASMLIB

Every disk that the Oracle Database accesses using ASMLIB must be labeled. This topic describes how to create an ASM disk label, verify it, and how to remove a label.

The following commands show how to scan disks, and create ASM disk labels. Instructions are also provided for viewing and querying disk labels and also for removing them.

  1. Use the oracleasm scandisks command to scan all block devices attached to the system for ASM disk labels and make any ASM disks found available to ASM.
    sudo oracleasm scandisks

    Output might appear similar to the following:

    Reloading disk partitions: done
    Cleaning any stale ASM disks...
    Scanning system for ASM disks...
  2. Use the oracleasm createdisk command to label a disk.
    sudo oracleasm createdisk VOL1 /dev/sdg1

    The following output might be displayed:

    Writing disk header: done
    Instantiating disk: done
  3. Use the oracleasm listdisks command to view existing disk labels.
    sudo oracleasm listdisks

    Output might appear similar to the following:

    VOL1
    VOL2
    VOL3
  4. Use the oracleasm querydisk command to check whether a disk device has a label.
    sudo oracleasm querydisk /dev/sdg1

    If the device isn't labeled as an ASM disk, the following output is displayed:

    Device "/dev/sdg1" is not marked as an ASM disk
    If the device is labeled as an ASM disk, output appears as follows:
    Device "/dev/sdg1" is marked an ASM disk with the label "VOL1"
    You can also query an ASM disk label to see whether the label is valid, for example:
    sudo oracleasm querydisk VOL1
  5. Use the oracleasm deletedisk command to remove an ASM label from a disk.
    sudo oracleasm deletedisk VOL1

    The following output might be displayed:

    Clearing disk header: done
    Dropping disk: done

When you have finished configuring disk availability, you can check that the disks are visible in ASM. See Validating ASM Disk Visibility Using a Discovery String.

Checking ASMLIB Configuration Status

Use the oracleasm status command to show the status of ASMLIB configuration. This command can help identify issues and can show which features are enabled.

  • Run oracleasm status to view the current configuration status.
    sudo oracleasm status
    The following example output is taken from a system running UEK R6:
    Checking if the oracleasm kernel module is loaded: yes
    Checking if /dev/oracleasm is mounted: yes
    
    The following checks are performed:
    • Check if the oracleasm kernel module is loaded.

    • Check if the /dev/oracleasm is mounted.

Validating ASM Disk Visibility Using a Discovery String

ASM uses discovery strings to describe which of the labeled ASM disks attached to a system are available to the Oracle Database instance.

Use the oracleasm-discover command to validate ASM discovery strings and view characteristics of the associated ASM disks.

  • List all ASM disks on the system.
    sudo oracleasm-discover

    The following output might be displayed:

    Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
    [ASM Library - Generic Linux, version 2.0.16 (KABI_V2)]
    Discovered disk: ORCL:DB1 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
    Discovered disk: ORCL:DB2 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
    Discovered disk: ORCL:VOL1 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
    Discovered disk: ORCL:VOL2 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
  • List all ASM disks whose labels begin with "VOL".
    sudo oracleasm-discover ORCL:VOL\*

    The following output might be displayed:

    Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
    [ASM Library - Generic Linux, version 2.0.16 (KABI_V2)]
    Discovered disk: ORCL:VOL1 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]
    Discovered disk: ORCL:VOL2 [1044162 blocks (534610944 bytes), blksz 512/512, maxio 524288 bytes, integrity none]