Sunday, November 7, 2010

Add/remove disks to ASM Diskgroup


[11gr2@rh5 ~]$ sqlplus '/ as sysasm'

SQL*Plus: Release 11.2.0.2.0 Production on Sun Nov 7 20:35:35 2010

Copyright (c) 1982, 2010, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Automatic Storage Management option

SQL> alter diskgroup data add disk '/dev/hda2','/dev/hda3';

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
1 REBAL RUN 1 1 33 1567 246
6


SQL> alter diskgroup data drop disk DATA_0006,DATA_0001;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
1 REBAL RUN 1 1 1 2399 0
0


SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
1 REBAL RUN 1 1 1 2399 0
0


SQL> alter diskgroup data rebalance power 11;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
1 REBAL RUN 11 11 0 1889 0
0


SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
1 REBAL RUN 11 11 0 1889 0
0


SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
1 REBAL RUN 11 11 435 1687 343
3


SQL> select * from v$asm_diskgroup;

GROUP_NUMBER NAME SECTOR_SIZE BLOCK_SIZE
------------ ------------------------------ ----------- ----------
ALLOCATION_UNIT_SIZE STATE TYPE TOTAL_MB FREE_MB HOT_USED_MB
-------------------- ----------- ------ ---------- ---------- -----------
COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ----------------------- -------------- -------------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY V
------------------------------------------------------------ -
1 DATA 512 4096
1048576 MOUNTED NORMAL 5383 641 0
4742 856 -107 0
11.2.0.0.0
10.1.0.0.0 N


SQL> /

GROUP_NUMBER NAME SECTOR_SIZE BLOCK_SIZE
------------ ------------------------------ ----------- ----------
ALLOCATION_UNIT_SIZE STATE TYPE TOTAL_MB FREE_MB HOT_USED_MB
-------------------- ----------- ------ ---------- ---------- -----------
COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ----------------------- -------------- -------------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY V
------------------------------------------------------------ -
1 DATA 512 4096
1048576 MOUNTED NORMAL 5383 641 0
4742 856 -107 0
11.2.0.0.0
10.1.0.0.0 N


SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
1 REBAL RUN 11 11 1595 1819 344
0


SQL> select name,path,state from v$asm_disk;
.

NAME
------------------------------
PATH
--------------------------------------------------------------------------------
STATE
--------

/dev/hda8
NORMAL


/dev/hda9
NORMAL


/dev/hda12
NORMAL


/dev/hda13
NORMAL

DATA_0000
/dev/hda1
NORMAL

DATA_0002
/dev/hda2
NORMAL

DATA_0007
/dev/hda3
NORMAL

DATA_0003
/dev/hda5
NORMAL

DATA_0004
/dev/hda6
NORMAL

DATA_0005
/dev/hda7
NORMAL

DATA_0006
/dev/hda10
DROPPING

DATA_0001
/dev/hda11
DROPPING


12 rows selected.

SQL> SQL> col path for a30
SQL> l
1* select name,path,state from v$asm_disk
SQL> /

NAME PATH STATE
------------------------------ ------------------------------ --------
/dev/hda10 NORMAL
/dev/hda11 NORMAL
/dev/hda8 NORMAL
/dev/hda9 NORMAL
/dev/hda12 NORMAL
/dev/hda13 NORMAL
DATA_0000 /dev/hda1 NORMAL
DATA_0002 /dev/hda2 NORMAL
DATA_0007 /dev/hda3 NORMAL
DATA_0003 /dev/hda5 NORMAL
DATA_0004 /dev/hda6 NORMAL
DATA_0005 /dev/hda7 NORMAL

12 rows selected.

[11gr2@rh5 ~]$ asmcmd -p
ASMCMD [+] > lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED NORMAL N 512 4096 1048576 5383 645 857 -106 0 N DATA/
ASMCMD [+] > lsdsk
Path
/dev/hda1
/dev/hda2
/dev/hda3
/dev/hda5
/dev/hda6
/dev/hda7
ASMCMD [+] > lsdsk -k
Total_MB Free_MB OS_MB Name Failgroup Library Label UDID Product Redund Path
503 26 503 DATA_0000 DATA_0000 System UNKNOWN /dev/hda1
976 129 976 DATA_0002 DATA_0002 System UNKNOWN /dev/hda2
976 130 976 DATA_0007 DATA_0007 System UNKNOWN /dev/hda3
976 119 976 DATA_0003 DATA_0003 System UNKNOWN /dev/hda5
976 119 976 DATA_0004 DATA_0004 System UNKNOWN /dev/hda6
976 122 976 DATA_0005 DATA_0005 System UNKNOWN /dev/hda7

ASMCMD [+] > lsdsk -p
Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Path
1 0 3915928005 CACHED MEMBER ONLINE NORMAL /dev/hda1
1 2 3915928015 CACHED MEMBER ONLINE NORMAL /dev/hda2
1 7 3915928016 CACHED MEMBER ONLINE NORMAL /dev/hda3
1 3 3915928008 CACHED MEMBER ONLINE NORMAL /dev/hda5
1 4 3915928009 CACHED MEMBER ONLINE NORMAL /dev/hda6
1 5 3915928010 CACHED MEMBER ONLINE NORMAL /dev/hda7

ASMCMD [+] > lsdsk --candidate -p
Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Path
0 0 3915928017 CLOSED FORMER ONLINE NORMAL /dev/hda10
0 1 3915928018 CLOSED FORMER ONLINE NORMAL /dev/hda11
0 10 3915928003 CLOSED CANDIDATE ONLINE NORMAL /dev/hda12
0 11 3915928004 CLOSED CANDIDATE ONLINE NORMAL /dev/hda13
0 6 3915927999 CLOSED CANDIDATE ONLINE NORMAL /dev/hda8
0 7 3915928000 CLOSED CANDIDATE ONLINE NORMAL /dev/hda9
ASMCMD [+] > lsdsk --statistics
Reads Write Read_Errs Write_Errs Read_time Write_Time Bytes_Read Bytes_Written Voting_File Path
1416 3504 0 0 305.382626 429.681339 425697280 656793600 N /dev/hda1
77 1039 0 0 32.462891 652.342351 48402432 900378624 N /dev/hda2
54 1228 0 0 22.873951 624.192306 33648640 892911616 N /dev/hda3
2480 3350 0 0 492.988123 774.127265 685920256 958545920 N /dev/hda5
2642 4277 0 0 422.318022 809.221004 656359424 968208384 N /dev/hda6
2528 3378 0 0 450.579072 868.434136 636690432 1029386240 N /dev/hda7