ASM Query
ASM Query
=========
1. Check if ASM is healthy?
crsctl check cssd
If ASM was never initiated, use the following:
/u01/app/oracle/product/10.2.0/asm/bin/localconfig add
2. Check the status of ASM instance
ps -ef |grep -i asm
3. Check all ASM related dictionary views. (from the database instance)
set linesize 200
set pagesize 200
col object_name format a40
select
owner,
object_name,
object_type
from
dba_objects
where
object_name like '%ASM%'
AND
object_name like 'V%'
and
object_type='SYNONYM'
order by 2;
4. How to create diskgroup?
From ASM instance SQL:
External CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK 'ORCL:VOL_SDC1', 'ORCL:V
OL_SDC2';
CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK 'ORCL:VOL_SDC7', 'ORCL:VOL_SDC8';
Normal CREATE DISKGROUP DATA NORMAL REDUNDANCY
FAILGROUP DATA DISK 'ORCL:VOL_SDC10'
FAILGROUP DATA_FL1 DISK 'ORCL:VOL_SDD10';
High CREATE DISKGROUP DATA NORMAL HIGH
FAILGROUP DATA DISK 'ORCL:VOL_SDC10'
FAILGROUP DATA_FL1 DISK 'ORCL:VOL_SDD10'
FAILGROUP DATA_FL2 DISK 'ORCL:VOL_SDE10'
5. How to completely drop diskgroup?
DROP DISKGROUP DATA;
6. To add the disk to diskgroup
ALTER DISKGROUP DATA ADD DISK '/dev/sdc4' NAME VOL_SDC4, '/dev/sdc5' NAME VOL_SD
C5;
7. To drop the disk from diskgroup
ALTER DISKGROUP DATA DROP DISK VOL_SDC45;
8. How to check the diskspace usage
select name, round((round(total_mb,2)-round(free_mb,2))/1024,2) as USED_GB, roun
d(free_mb/1024,2) as FREE_GB,
round(total_mb/1024,2) as TOTAL_GB from v$asm_diskgroup;
9. To check the name and path of all the ASM disks (run from ASM instance)
set linesize 200
13. To find out if there are any FREE DISKS available which are already presente
d to ASM instance
and not allotted to any Disk Group.
--Login to ASM instance and execute the following.
col name format a8
col path format a16
set linesize 200
select group_number, disk_number, state, name, path, MOUNT_STATUS, HEADER_STATUS
, MODE_STATUS from
v$asm_disk where header_status in ('FORMER', 'CANDIDATE');
14. List the disks that are presented to ASM
As root:
/etc/init.d/oracleasm listdisks
15. Check ASM Mapping:
chk_asm_mapping.sh
/etc/init.d/oracleasm querydisk -d `/etc/init.d/oracleasm listdisks -d` |
cut -f2,10,11 -d" " | perl -pe 's/"(.*)".*\[(.*), *(.*)\]/$1 $2 $3/g;' |
while read v_asmdisk v_minor v_major
do
v_device=`ls -la /dev | grep " $v_minor, *$v_major " | awk '{print $10}'`
echo "ASM disk $v_asmdisk based on /dev/$v_device [$v_minor, $v_major]"
done
ASM disk C1D1P1 based on /dev/ [105, 17]
ASM disk C1D1P2 based on /dev/ [105, 18]
ASM disk C1D1P3 based on /dev/ [105, 19]
ASM disk C1D1P5 based on /dev/ [105, 21]
ASM Queries --Moid - Google Docs https://docs.google.com/document/d/1B8aAzHjmO-H
oo5AIeQ8LifUwS_...
4 of 11 8/30/2012 12:47 PM
ASM disk C1D1P6 based on /dev/ [105, 22]
ASM disk C1D1P7 based on /dev/ [105, 23]
ASM disk C1D1P8 based on /dev/ [105, 24]
ASM disk C1D2P1 based on /dev/ [105, 33]
ASM disk C1D2P2 based on /dev/ [105, 34]
ASM disk C1D2P3 based on /dev/ [105, 35]
ASM disk C1D2P5 based on /dev/ [105, 37]
ASM disk C1D2P6 based on /dev/ [105, 38]
ASM disk C1D2P7 based on /dev/ [105, 39]
ASM disk C1D2P8 based on /dev/ [105, 40]
ASM disk C1D3P1 based on /dev/ [105, 49]
ASM disk C1D3P2 based on /dev/ [105, 50]
ASM disk C1D3P3 based on /dev/ [105, 51]
ASM disk C1D3P5 based on /dev/ [105, 53]
ASM disk C1D3P6 based on /dev/ [105, 54]
ASM disk C1D3P7 based on /dev/ [105, 55]
ASM disk C1D3P8 based on /dev/ [105, 56]
16. To mount all disk group
alter diskgroup all mount;
17. To mount one disk group
alter diskgroup DATA mount;
18. To dismount all disks group
alter diskgroup all dismount;
19. To dismount one disk group
/etc/init.d/oracleasm status
/etc/init.d/oracleasm disable
/etc/init.d/oracleasm enable
/etc/init.d/oracleasm createdisk vol_sdc1 /dev/sdc1
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm deletedisk vol_sdc1
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm listdisks
/etc/init.d/oracleasm querydisks
/etc/init.d/oracleasm start
/etc/init.d/oracleasm stop
/etc/init.d/oracleasm status
/etc/init.d/oracleasm restart
[root@RHEL5-PH-223 ~]# /usr/sbin/oracleasm
Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
oracleasm --exec-path
oracleasm -h
oracleasm -V
The basic oracleasm commands are:
configure Configure the Oracle Linux ASMLib driver
init Load and initialize the ASMLib driver
exit Stop the ASMLib driver
ASM Queries --Moid - Google Docs https://docs.google.com/document/d/1B8aAzHjmO-H
oo5AIeQ8LifUwS_...
8 of 11 8/30/2012 12:47 PM
scandisks Scan the system for Oracle ASMLib disks
status Display the status of the Oracle ASMLib driver
listdisks List known Oracle ASMLib disks
querydisk Determine if a disk belongs to Oracle ASMlib
createdisk Allocate a device for Oracle ASMLib use
deletedisk Return a device to the operating system
renamedisk Change the label of an Oracle ASMlib disk
update-driver Download the latest ASMLib driver
25. Other commands for managing non-RAC (possibly 10g commands?)
init+ASM.ora
.cluster_database= true
.asm_diskstring = /dev/sd*1
.instance_type=asm
.shared_pool_size=100M
.large_pool_size = 80M
.db_cache_size=60M
.asm_diskgroups = DATA , FRA
.processes=128
Initialize ASM for non-RAC
./localconfig add
Manually start CSSD (non-RAC)
/etc/init.d/init.cssd start
Manually stop CSSD (non-RAC)
/etc/init.d/init.cssd stop
Resetting CSS to new Oracle Home
localconfig reset /apps/oracle/product/11.1.0/ASM
crsctl check has
crsctl stop has
crsctl start has
crsctl check resource
crsctl start resource -all
crsctl stop resource -all
crs_stat -t
ASM Queries --Moid - Google Docs https://docs.google.com/document/d/1B8aAzHjmO-H
oo5AIeQ8LifUwS_...
9 of 11 8/30/2012 12:47 PM
********************************************************************************
****************************************
Starting from 11g:
crsctl stop resource -all ? when ran on RAC, it will shutdown resources on all n
odes.
crsctl start resource -all ? when ran on RAC, it will startup all resource on al
l nodes.
Other notes:
********************************************************************************
****************
[root@Linux-VM-204 ~]# /u01/app/oracle/product/10.2.0/asm/bin/localconfig
Usage:/u01/app/oracle/product/10.2.0/asm/bin/localconfig [add] [delete] [ reset
<destination Oracle home> ]
[-silent] [-paramfile <Complete path of file specifying parameter values>]
fdisk -l /dev/sdc
Install ASMLib
/etc/init.d/oracleasm configure
/etc/init.d/oracleasm status
/etc/init.d/oracleasm disable
/etc/init.d/oracleasm enable
/etc/init.d/oracleasm createdisk vol_sdc1 /dev/sdc1
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm deletedisk vol_sdc1
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm listdisks
/etc/init.d/oracleasm querydisks
/etc/init.d/oracleasm start
/etc/init.d/oracleasm stop
/etc/init.d/oracleasm status
/etc/init.d/oracleasm restart
Good Links for scripts:
http://www.shutdownabort.com/dbaqueries/Administration_ASM.php
http://www.dbasupport.com/oracle/ora10g/ASM0302.shtml
10g ASM Document
http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/storeman.htm#i102
1337
11g ASM Document
http://docs.oracle.com/cd/B28359_01/server.111/b31107/asmfiles.htm#i1020023
ASM Queries --Moid - Google Docs https://docs.google.com/document/d/1B8aAzHjmO-H
oo5AIeQ8LifUwS_...
10 of 11 8/30/2012 12:47 PM
ASM Queries --Moid - Google Docs https://docs.google.com/document/d/1B8aAzHjmO-H
oo5AIeQ8LifUwS_...
11 of 11 8/30/2012 12:47 PM