March 02, 2013

ASM Troubleshooting


# /proc/partitions - shows the major minor numbers for the device at OS level

# asmcmd lsdsk -p

# /etc/init.d/oracleasm status
# /etc/init.d/oracleasm listdisks

# ls -l /dev/oracleasm
# ls -l /dev/oracleasm/disks

# oracleasm query disk /dev/mapper/<ASMLABEL>

# fdisk -l /dev/mapper/<ASMLABEL>
# fdisk -l /dev/sd-10 ----- OS level

Set the environment for the asm
-------------------------------

uname
cat /etc/oratab OR cat /var/opt/oracle/oratab
export ORACLE_SID=<DBNAME>
export ORACLE_HOME=<>
export PATH=$PATH:$ORACLE_HOME/bin

ps -ef| grep asm

. oraenv
+ASM

ASM Space Report
----------------

SET LINESIZE 150
SET PAGESIZE 9999
SET VERIFY off
COLUMN group_name FORMAT a20 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'

SELECT
distinct 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 gv$asm_diskgroup ORDER BY name
/

ASM Disk Space Usage Report In Detail
-------------------------------------

SET LINESIZE 150
SET PAGESIZE 9999
SET VERIFY off
COLUMN disk_group_name FORMAT a15 HEAD 'Disk Group Name'
COLUMN disk_file_path FORMAT a17 HEAD 'Path'
COLUMN disk_file_name FORMAT a20 HEAD 'File Name'
COLUMN disk_file_fail_group FORMAT a20 HEAD 'Fail Group'
COLUMN total_mb FORMAT 999,999,999 HEAD 'File 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 'Disk Group' of total_mb used_mb on disk_group_name
compute sum label 'ASM Disk Group Total Size in MB' of total_mb used_mb on report
SELECT
NVL(a.name, '[CANDIDATE]') disk_group_name
, b.path disk_file_path
, b.name disk_file_name
, b.failgroup disk_file_fail_group
, b.total_mb total_mb
, (b.total_mb - b.free_mb) used_mb
, ROUND((1- (b.free_mb / b.total_mb))*100, 2) pct_used
FROM v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number) where b.header_status <> 'PROVISIONED'
ORDER BY a.name
/

OTHER ASM QUERIES
-----------------

set pages 9999 lines 900

SELECT GROUP_NUMBER, NAME, TYPE, STATE, ceil (total_mb/1024) TOTAL_GB,ceil (free_mb/1024) FREE_GB,
ceil ((required_mirror_free_mb)/1024),ceil ((usable_file_mb)/1024), SYSDATE
FROM V$ASM_DISKGROUP order by NAME;

SELECT GROUP_NUMBER, NAME, TYPE, STATE, ceil (total_mb/1024) TOTAL_GB,ceil (free_mb/1024) FREE_GB,
ceil ((required_mirror_free_mb)/1024),ceil ((usable_file_mb)/1024), SYSDATE
FROM GV$ASM_DISKGROUP order by NAME;

select GROUP_NUMBER,DISK_NUMBER,TOTAL_MB,FREE_MB,NAME,MOUNT_STATUS from v$asm_disk;
select INST_ID,GROUP_NUMBER,DISK_NUMBER,TOTAL_MB,FREE_MB,NAME,MOUNT_STATUS from gv$asm_disk;

select table_name from dict where table_name like '%ASM%';

No comments:

Post a Comment