As a Linux system administrator, you should know about an OracleASM commands to manage them at OS level.
Because, initially this task is performed by OS admin, what they are doing on this?, they are adding a raw disk as an ASM disk in system.
Navigate to the following article, if you would like to manage oracleasm service such as start, stop, restart, enable, disable and status of the service.
Once we add a disk at OS level then Database admin can able to see them at their end.They can able to add the disk into the data group once it’s visible at their end.
If it’s an Oracle Real Application Clusters (Oracle RAC) then you need to scan the disks in other systems once it was added in the first system.
Note: As part of prerequisites the Storage team should share the LUNs to both the servers.
Navigate to the following article, if you would like to map Oracle ASM disks against physical disk and LUNs in Linux.
The oracleasm command utility is part of the Oracle ASMLib that allows user to manager oracleasm instance. You should have root or sudo privileges to run these commands.
What is ASMLib?
ASMLib is an optional support library for the Automatic Storage Management feature of the Oracle Database.
Automatic Storage Management (ASM) simplifies database administration and greatly reduces kernel resource usage (e.g. the number of open file descriptors).
It eliminates the need for the DBA to directly manage potentially thousands of Oracle database files, requiring only the management of groups of disks allocated to the Oracle Database. ASMLib allows an Oracle Database using ASM more efficient and capable access to the disk groups it is using.
1) How to list available options for OracleASM service
If you are new to Linux or if you don’t know about this service before, just use the following command to know the list of the available options for the given service.
For SysV (System V) or Upstart init system.
# /etc/init.d/oracleasm Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
2) How to configure ASMLib in Linux?
Use the below commands to configure ASMLib in Linux, make sure you have to run an appropriate command depends up on your init system manager.
After ASMLib software is installed, you have to take following steps to make the ASM driver available. The ASM driver needs to be loaded, and the driver filesystem needs to be mounted. This is taken care of by the initialization script.
It will ask for the user and group that default to owning the ASM driver access point. If the database was running as the ‘oracle’ user and the ‘dba’ group, the output would look like this.
# oracleasm configure -i [For SysV/Upstart init Systems] # /etc/init.d/oracleasm configure or # service oracleasm configure [For systemd init Systems] # /usr/sbin/oracleasm configure -i
Output:
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) [n]: y Fix permissions of Oracle ASM disks on boot (y/n) [y]: y Writing Oracle ASM library driver configuration [ OK ] Creating /dev/oracleasm mount point [ OK ] Loading module "oracleasm" [ OK ] Mounting ASMlib driver filesystem [ OK ] Scanning system for ASM disks [ OK ]
3) How to initialize ASMLib
Use the below commands to load and initialize the ASMLib driver in Linux.
# oracleasm init
[For systemd init Systems]
# /usr/sbin/oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm
4) How to create OracleASM Disk?
Use the below commands to create a OracleASM disk in Linux, it depends on your init system manager.
[For systemd/SysV/Upstart init Systems] # oracleasm createdisk VOL1 /dev/sda1 [For SysV/Upstart init Systems] # /etc/init.d/oracleasm createdisk VOL1 /dev/sda1 or # service oracleasm createdisk VOL1 /dev/sda1 Writing disk header: done Instantiating disk: done
5) How to scan OracleASM Disks?
Use the below commands to scan the OracleASM disks in Linux, it depends on your init system manager.
[For systemd/SysV/Upstart init Systems] # oracleasm scandisks [For SysV/Upstart init Systems] # /etc/init.d/oracleasm scandisks or # service oracleasm scandisks Scanning system for ASM disks [ OK ]
6) How to list OracleASM Disks?
Use the below commands to List available/created OracleASM disks in Linux, it depends on your init system manager.
[For systemd/SysV/Upstart init Systems] # oracleasm listdisks [For SysV/Upstart init Systems] # /etc/init.d/oracleasm listdisks or # service oracleasm listdisks VOL1 VOL2 VOL3
7) How to query OracleASM Disk?
Use the below commands to query the given OracleASM disk in Linux, it depends on your init system manager.
[For systemd/SysV/Upstart init Systems] # oracleasm querydisk VOL1 [For SysV/Upstart init Systems] # /etc/init.d/oracleasm querydisk VOL1 or # service oracleasm querydisk VOL1 Disk "VOL1" is a valid ASM disk
8) How to rename OracleASM Disk?
Use the below commands to rename the given OracleASM disk in Linux, it depends on your init system manager.
[For systemd/SysV/Upstart init Systems] # oracleasm renamedisk VOL1 VOL4 [For SysV/Upstart init Systems] # /etc/init.d/oracleasm renamedisk VOL1 VOL4 or # service oracleasm renamedisk VOL1 VOL4 Renaming disk "VOL1" to "VOL4": [ OK ]
9) How to delete OracleASM Disk?
Use the below commands to delete the given OracleASM disk in Linux, it depends on your init system manager.
[For systemd/SysV/Upstart init Systems] # oracleasm deletedisk VOL2 [For SysV/Upstart init Systems] # /etc/init.d/oracleasm deletedisk VOL2 or # service oracleasm deletedisk VOL2 Deleting Oracle ASM disk "VOL2" [ OK ]
Note:
ASMLib uses configuration file /etc/sysconfig/oracleasm, which is a link to file /etc/sysconfig/oracleasm-_dev_oracleasm. Tools read file /etc/sysconfig/oracleasm-_dev_oracleasm so make sure that it’s link from /etc/sysconfig/oracleasm is not broken. User should run /usr/sbin/oracleasm configure -I to modify configuration parameters.