oracledba.help
System

ASM Administration

Add New Disk to ASM Group Roadmap

  1. In hardware\Vmware\VirtualBox
    1. Create disk.
    2. Set as Shareable.
    3. Add new disk to RAC Node 1.
    4. Attach new disk to other RAC nodes.
  2. Linux OS:
    1. Partition new disk.
      1. fdisk (2 TB or less)
      2. parted (2 TB plus\EXT4)
    2. Update UDev configuration.
  3. Add new disk to ASM group.

VMware vs. Disk Skewing

  • If VMware and you find a new disk skews the disk order even after UDev, bring it in via a new SCSCI controller number.
  • For example, if on 2 2:2 use 1 1:1.

ASMCMD

Launch console:grid> asmcmd
Command Line:grid> asmcmd <cmd>
Example: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: DATA
  5. Select disk(s) for group. Ex: [x] /dev/sdc1
  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.

Changing the Power option value can help shorten the time of a REBAL.

Add Disk

  1. Login as grid user.
  2. asmca &
  3. Expand Disk Groups
  4. Right-click on Disk Group name to add disk.
  5. Select Add Disks.
  6. Select disk(s) for group.
    Ex1: [x] /dev/asm-disk04
    Ex2: [x] /dev/sde1
  7. Select OK

Example Oracle Alert Log Entries

 2021-10-14T14:12:22.536719-04:00
 NOTE: ASMB process initiating disk discovery for grp 1 (reqid:10403972101718538279)
 2021-10-14T14:12:23.889750-04:00
 NOTE: Assigning number (1,1) to disk (/dev/asm-disk04)
 SUCCESS: completed reconfiguration of group 1 (DATA)

Drop Disk

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

Example Oracle Alert Log Entries

 2021-10-14T14:15:00.578112-04:00
 NOTE: updating disk modes to 0x5 from 0x7 for disk 1 (DATA_0001) in group 1 (DATA): lflags 0x0    
 NOTE: disk 1 (DATA_0001) in group 1 (DATA) is offline for reads
 NOTE: updating disk modes to 0x1 from 0x5 for disk 1 (DATA_0001) in group 1 (DATA): lflags 0x0    
 NOTE: disk 1 (DATA_0001) in group 1 (DATA) is offline for writes
 SUCCESS: disk DATA_0001 (1.4042261182) dropped from diskgroup DATA

Add\Drop from Command Line

Add Disk

-- Show Current Disk Status

  set linesize 240
  COL group_number  FORMAT 9999
  COL name          FORMAT a15
  COL header_status FORMAT a25
  COL path          FORMAT a25
  SELECT group_number group#, name, header_status, path FROM V$ASM_DISK;
     GROUP# NAME            HEADER_STATUS             PATH
 ---------- --------------- ------------------------- -------------------------
          1 DATA_0001       MEMBER                    /dev/sde1
          2 FRA_0000        MEMBER                    /dev/sdc1
          3 GRID_0000       MEMBER                    /dev/sdb1
          1 DATA_0000       MEMBER                    /dev/sdd1
          0                 CANDIDATE                 /dev/sdf1

Note GROUP# is 0.

-- Add Disk to Group

 grid> sqlplus / as sysasm
 ALTER DISKGROUP DATA ADD DISK '/dev/sdf1';
 Diskgroup altered.

Replace blue items with values for your environment.

Drop Disk

-- Get Disk Name to Drop

  set linesize 240
  COL group_number  FORMAT 9999
  COL name          FORMAT a15
  COL header_status FORMAT a25
  COL path          FORMAT a25
  SELECT group_number group#, name, header_status, path FROM V$ASM_DISK;
  Example: DATA_0001

-- Drop Disk

 grid> sqlplus / as sysasm
 ALTER DISKGROUP DATA DROP DISK 'DATA_0001';
 Diskgroup altered.

Replace blue items with values for your environment.

-- Common Error: ORA-15054

 ALTER DISKGROUP DATA DROP DISK '/dev/sdf1';
 ERROR at line 1:
 ORA-15032: not all alterations performed
 ORA-15054: disk "/dev/sdf1" does not exist in diskgroup "DATA"

Solution: Specify disk NAME not PATH.

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

ASM Space Usage

asmcmd

 grid> asmcmd -p lsdg

SQL

SET LINESIZE  145
SET PAGESIZE  9999
SET VERIFY    off
COLUMN group_name             FORMAT a12           HEAD 'Disk Group|Name'
COLUMN sector_size            FORMAT 99,999        HEAD 'Sector|Size'
COLUMN block_size             FORMAT 99,999        HEAD 'Block|Size'
COLUMN allocation_unit_size   FORMAT 999,999,999   HEAD 'Allocation|Unit Size'
COLUMN state                  FORMAT a11           HEAD 'State'
COLUMN type                   FORMAT a6            HEAD 'Type'
COLUMN total_mb               FORMAT 999,999,999   HEAD 'Total Size (MB)'
COLUMN used_mb                FORMAT 999,999,999   HEAD 'Used Size (MB)'
COLUMN pct_used               FORMAT 999.99        HEAD 'Pct. Used'

break on report on disk_group_name skip 1
compute sum label "Grand Total: " of total_mb used_mb on report

SELECT
    name                                     group_name
  , sector_size                              sector_size
  , block_size                               block_size
  , allocation_unit_size                     allocation_unit_size
  , state                                    state
  , type                                     type
  , total_mb                                 total_mb
  , (total_mb - free_mb)                     used_mb
  , ROUND((1- (free_mb / total_mb))*100, 2)  pct_used
FROM
    v$asm_diskgroup
ORDER BY
    name
/

Show ASM Disks

COL name     FORMAT a15
COL os_mb    FORMAT 999,999,999,999
COL total_mb FORMAT 999,999,999,999
COL path     FORMAT a25
SELECT name, disk_number, os_mb, total_mb, path, group_number
FROM V$ASM_DISK_STAT
ORDER BY name;

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
 NAME             TYPE        VALUE
 ---------------- ----------- ----- 
 asm_power_limit  integer     1

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

 grid> asmcmd -p lsop
 Group_Name  Pass       State  Power  EST_WORK  EST_RATE  EST_TIME  
 DATA        COMPACT    WAIT   1      0         0         0         
 DATA        REBUILD    DONE   1      0         0         0         
 DATA        REBALANCE  RUN    1      1794      17404     0         

Alter Power

 ALTER DISKGROUP DATA REBALANCE POWER 8;

Default power value is 1.

Resize Disk Session

Change values to match your environment.

 1. Disable CRS auto-start.
 2. Shutdown OS if required in your environment to resize hardware volume\disk.
 3. Resize hardware.
 4. Start Linux OS.
 5. From Linux resize the disk.
    parted
      (parted) select /dev/sdc
      (parted) print
      (parted) resizepart
      (parted) End? [20.0GB]? 25GB
      (parted) print
      (parted) quit
      lsblk
      ... sdc1 8:33 0 23.3G  0 part
 6. Start CRS and ensure there are no errors.
 7. Login as grid and from sqlplus resize ASM disk.
    -- Get Disk Info
    SELECT name, disk_number, os_mb, total_mb, path, group_number
    FROM V$ASM_DISK_STAT ORDER BY name;
    ...DATA_0000

    -- Resize
    SQL> ALTER DISKGROUP DATA RESIZE DISK DATA_0000 SIZE 23G;
    Diskgroup altered.

Virtualbox Disk Resizing Considerations

VBox Disk Resizing Fun Facts!

  • In VBox disk Disk File Type for ASM must be Fixed.
    This is because only Fixed disks can have the Shareable attrbute set.
  • However, in VBox only Dynamic disks can be resized.
  • In Linux you can use the parted resizepart cmd to resize a partition.

Some have found cloning a VM with a Fixed disk will make it Dynamic on the clone (and thus resizable).

Solution for Testing ASM Resize in VBox
Phase I

  1. Dont create the Linux partition for the entire VBox allocated disk (at first).
    Ex: If 200g allocated create a 100g partition.
  2. Create ASM disk to match Linux partition size.

Phase II

  1. Use the Linux parted resizepart to full size of Vbox allocated disk. Ex: 200gb.
  2. To resize disk in ASM use:
    ALTER DISKGROUP <disk_group> RESIZE DISK <disk> SIZE <nnnG>;
    ALTER DISKGROUP data_1 RESIZE DISK data_001 SIZE 200G;

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 -stop [option abort -force]

Status

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

Remote (RAC Database instance1: rac1.)

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

---

Sweep ASM

Only do this post deletion of a database!

rm -f +data/ORADB/CONTROLFILE/*
rm -f +data/ORADB/DATAFILE/*
rm -f +data/ORADB/ONLINELOG/*
rm -f +data/ORADB/TEMPFILE/*

rm -f +fra/ORADB/CONTROLFILE/*
rm -f +fra/ORADB/ONLINELOG/*

Alternatively

 cd +data
 rm -rf ORADB

 cd +fra
 rm -rf ORADB

Will not work if data in directories is being used. You might need to reboot node or at least bounce the cluster.

Show ASM Free Space

 grid> asmcmd -p lsdg

References