How To Manage OracleASM Disk And Service in Linux System

As a Linux system administrator, you need to bounce a service or daemon when it required.

It could be for various reasons such as service hung, service crashing, high load on the server, to make a configuration change take affect.

We need to bounce a services based on the init system manager but for oracleasm we can do it without service command as well.

Most of the Linux distribution fall in under one of the init system such as System V or Upstart or systemd.

These init scripts were typically written in Bash, and allowed the system administrator to control the state of services and daemons in their system.

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 Start OracleASM Service

Use the below commands to start the OracleASM service in Linux, it depends on your init system manager.

# oracleasm start

[For SysV/Upstart init Systems]
# /etc/init.d/oracleasm start
or
# service oracleasm start

[For systemd init Systems]
# systemctl start oracleasm.service
or
# systemctl start oracleasm

3) How To Stop OracleASM Service

Use the below commands to stop the OracleASM service in Linux, it depends on your init system manager.

# oracleasm stop

[For SysV/Upstart init Systems]
# /etc/init.d/oracleasm stop
or
# service oracleasm stop

[For systemd init Systems]
# systemctl stop oracleasm.service
or
# systemctl stop oracleasm

4) How To Restart OracleASM Service

Use the below commands to restart the OracleASM service in Linux, it depends on your init system manager.

# oracleasm restart

[For SysV/Upstart init Systems]
# /etc/init.d/oracleasm restart
or
# service oracleasm restart

[For systemd init Systems]
# systemctl restart oracleasm.service
or
# systemctl restart oracleasm

5) How To Check The Status Of OracleASM Service

Use the below commands to check the status of OracleASM service in Linux, make sure you have to run an appropriate command depends up on your init system manager.

# oracleasm status

[For SysV/Upstart init Systems]
# /etc/init.d/oracleasm status
or
# service oracleasm status

[For systemd init Systems]
# systemctl status oracleasm.service
or
# systemctl status oracleasm

Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

6) How To Enable OracleASM Service

Use the below commands to enable the OracleASM service in Linux, it depends on your init system manager.

# oracleasm enable

[For SysV/Upstart init Systems]
# chkconfig oracleasm on

[For systemd init Systems]
# systemctl enable oracleasm.service
or
# systemctl enable oracleasm

  Writing Oracle ASM library driver configuration            [  OK  ]
  Loading module "oracleasm"                                 [  OK  ]
  Mounting ASMlib driver filesystem                          [  OK  ]
  Scanning system for ASM disks                              [  OK  ]

7) How To Disable OracleASM Service

Use the below commands to disable the OracleASM service in Linux, it depends on your init system manager.

# oracleasm disable

[For SysV/Upstart init Systems]
# chkconfig oracleasm off

[For systemd init Systems]
# systemctl disable oracleasm.service
or
# systemctl disable oracleasm

  Writing Oracle ASM library driver configuration            [  OK  ]
  Unmounting ASMlib driver filesystem                        [  OK  ]
  Unloading module "oracleasm"                               [  OK  ]

8) How To Configure ASMLib

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  ]

9) 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

10) 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

11) 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  ]

12) 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

13) 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

14) 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  ]

15) 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.

Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

Shares
Close
Please support the site
By clicking any of these buttons you help our site to get better