oracledba.help works great on your mobile device too!

oracledba.help

ASM Administration

TOC

ASMCMD (ASM Command Line)

Launch console:grid> asmcmd
Run command from OS example:grid> asmcmd ls GRID/_mgmtdb/*

If you start ASMCMD with the -p the current directory shown as part of the prompt.

COMMANDDESCRIPTION
cdChange directory
cpCopy file
duDisk space used by a directory and its subdirectories
exitExit the utility.
findLocate the path for specified filename. Ex: find / spfile*
helpDisplays command assistance
lsList the contents of a directory
lsctList info about ASM clients
lsdgList all disk groups and their attributes
lsdskList all physical disks visible to ASM
md_backupCreate a backup of the mounted diskgroups
md_restoreRestore the diskgroups from a backup
mkaliasCreate an alias for a system generated filename
mkdirCreate directory
pwdPrint working directory (i.e. list current directory location)
remapRepair a range of blocks on a disk
rmRemove (i.e. delete) the specified files or directories
rmaliasRemove (i.e. delete) the specified alias

Disk Group

Create Group

Requires at least one disk to exist.

  1. Login as grid user.
  2. asmca &
  3. Select Create.
  4. Enter Disk Group Name: Ex: FRA
  5. Select disk(s) for group. Ex: [x] /dev/sde1
  6. Select OK

Drop Group

  1. Login as grid user.
  2. asmca &
  3. Right-click on desired Disk Group.
  4. Select Drop.
  5. Confirm Drop: select Yes.

Disks

Disk group rebalance is triggered automatically on ADD, DROP and RESIZE disk operations and on moving a file between hot and cold regions. This means you may experience very slow performance so do this during off hours if possible.

Add Disk

  1. Login as grid user.
  2. asmca &
  3. Right-click on Disk Group
  4. Select Add Disks.
  5. Select disk(s) for group. Ex: [x] /dev/sde1
  6. Select OK

Drop Disk

  1. Login as grid user.
  2. asmca &
  3. Right-click on desired Disk Group.
  4. Select Drop Disks.
  5. Select disk(s) to drop. Ex: [x] /dev/sde1
  6. Select OK

Alternatively
oracleasm deletedisk DISK01

Display

ASM Driver (/dev/oracleasm)

As root: oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

ASM & RAC Database Instances

[oracle@rac1]$ ps -ef | grep pmon

oracle    3325     1  0 17:39 ?        00:00:00 asm_pmon_+ASM1
oracle    3813     1  0 17:40 ?        00:00:00 mdb_pmon_-MGMTDB
oracle    5806     1  0 17:42 ?        00:00:00 ora_pmon_orcl1
oracle    6193     1  0 17:42 ?        00:00:00 apx_pmon_+APX1 
SQL> SELECT instance_name,instance_number FROM gv$instance;

INSTANCE_NAME           INSTANCE_NUMBER
-------------------------------------------
orcl2                         2
orcl1                         1

Cluster Services Status

[grid@rac1]$ crsctl check cluster

CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online

Disks, List

/usr/sbin/oracleasm listdisks
VOL01

ls -l /dev/oracleasm/disks
brw-rw----. 1 oracle dba 8, 17 Oct 11 08:23 VOL01

Flex ASM Usage

[grid@rac1]$ asmcmd
ASMCMD> showclustermode 
ASM cluster : Flex mode enabled
ASMCMD> showclusterstate
Normal

Instance

[oracle@rac1]$ srvctl status asm

ASM is running on rac2,rac1 

Rebalance

Status

 show parameter power

 SELECT INST_ID, OPERATION, STATE, POWER, SOFAR, EST_WORK, EST_RATE,EST_MINUTES 
 FROM GV$ASM_OPERATION 
 WHERE GROUP_NUMBER=1;

Start|Stop

Boot process controlled here: /etc/init.d/oracleasm

Start

[grid@db1 ~]$ srvctl start asm
ASM is running on db1

Stop

Local ASM

[grid@db1 ~]$ srvctl stop asm -stopoption abort -force

[grid@db1 ~]$ srvctl status asm
ASM is not running.

Remote (RAC Database instance1: rac1.)

[grid@db1 ~]$ srvctl stop asm -node rac1 -stopoption abort -force

APPENDIX: Enable Cluster Node to Use ASM Disks

On nodes in the cluster the scandisks command can be used to view the newly created Oracle ASM disks. You do not have to create the Oracle ASM disks on each node - only on one node in the cluster.

# /usr/sbin/oracleasm scandisks
Scanning system for ASM disks   [  OK  ]
# /usr/sbin/oracleasm listdisks
VOL01
VOL02
VOL03

Confirm ASM Configuration Identical on All Nodes

/usr/sbin/oracleasm configure

ORACLEASM_UID=oracle
ORACLEASM_GID=dba
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER="sd"
ORACLEASM_SCANEXCLUDE=""
ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"

APPENDIX: Allocate Disks Using ASMLib

Allocate Disk for ASM

Assumes disk has been allocated by your SA\SAN administrator.
ASMLib config file will be here when done: /etc/sysconfig/oracleasm

/usr/sbin/oracleasm init
/usr/sbin/oracleasm configure -I

Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

Device order to scan for ASM disks []: sd
Devices to exclude from scanning []: 
Use device logical block size for ASM (y/n) [n]: 
Writing Oracle ASM library driver configuration: done

Create ASM Disks

oracleasm createdisk <diskname> <device_name>

oracleasm status
oracleasm scandisks
oracleasm createdisk DISK01 /dev/sdb1
   Writing disk header: done
   Instantiating disk: done

oracleasm listdisks
   DISK01

APPENDIX: ASMLib Notes

The system administrator has one last task. Every disk that ASMLib is going to
be accessing needs to be made available. This is accomplished by creating an
ASM disk. The /etc/init.d/oracleasm script is again used for this task:

  [root@ca-test1 /]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdg1
  Creating Oracle ASM disk "VOL1"                            [  OK  ]


Disk names are ASCII capital letters, numbers, and underscores. They must start
with a letter. Disks that are no longer used by ASM can be unmarked as well:

  [root@ca-test1 /]# /etc/init.d/oracleasm deletedisk VOL1
  Deleting Oracle ASM disk "VOL1"                            [  OK  ]


Any operating system disk can be queried to see if it is used by ASM:

  [root@ca-test1 /]# /etc/init.d/oracleasm querydisk /dev/sdg1
  Checking if device "/dev/sdg1" is an Oracle ASM disk        [  OK  ]
  [root@ca-test1 /]# /etc/init.d/oracleasm querydisk /dev/sdh1
  Checking if device "/dev/sdh1" is an Oracle ASM disk        [FAILED]


Existing disks can be listed and queried:

  [root@ca-test1 /]# /etc/init.d/oracleasm listdisks
  VOL1
  VOL2
  VOL3
  [root@ca-test1 /]# /etc/init.d/oracleasm querydisk VOL1
  Checking for ASM disk "VOL1"                               [  OK  ]


When a disk is added to a RAC setup, the other nodes need to be notified about
it. Run the 'createdisk' command on one node, and then run 'scandisks' on every
other node:

  [root@ca-test1 /]# /etc/init.d/oracleasm scandisks
  Scanning system for ASM disks                              [  OK  ]