How to add disks to ASM disk group in oracle using command line.
Application team requested to create new user along with new tablespace. This is require to deploy new application to fulfil testing. As per requirement, we need additional space in our database.
Below are the steps that we have to follow to add ASM disk into disk groups.
STEP1: We have to check for OCR backup.
> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 4088
Available space (kbytes) : 258032
ID : 167969349
Device/File Name : +OCR
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check bypassed due to non-privileged user
STEP2: Check for voting disk.
> crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 8f168892c0504f80bf2f3818ead68d92 (ORCL:OCR01) [OCR]
Located 1 voting disk(s).
ASM disks have below types of status:
- PROVISIONED:– Newly disk added to ASM storage. Header status different from the CANDIDATE here means some additional task was performed by OS admin to make sure DISKS are available for ASM.
- CANDIDATE:- Disk is not the part of any disk group and may be able to added to respective disk group.
- FORMER:- Disks are part of DISKS group, but it was recreated and ready to add in DG.
- MEMBER:- Disk is the part of existing disk group and it can’t used to add in ASM.
- UNKNOWN:- Disk header has not been read.
- CONFLICT:- ASM disk not mounted due to a conflict.
- FOREIGN:- Disks contain data created by an Oracle product other than ASM. This includes datafiles, logfiles, and OCR disks.
- INCOMPATIBLE:- Version number in the disk header is not compatible with the ASM software version.
Step3: Validate newly allocated Disks are visible on all connected ASM instances. And make sure all newly allocated new disks are of same size.
SQL> set lines 180 pages 1000
SQL> col name for a30
col path for a35
select name, path, group_number group_#, disk_number disk_#, mount_status, header_status, state, os_mb/1024
from gv$asm_disk where mount_status = 'CLOSED' order by inst_id, name, path;SQL> SQL> 2
PATH GROUP_# DISK_# MOUNT_S HEADER_STATU STATE OS_MB/1024
----------------------------------- ---------- ---------- ------- ------------ -------- ----------
ORCL:ORCLDATA401 0 0 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA402 0 1 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA403 0 2 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA404 0 3 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA405 0 4 CLOSED PROVISIONED NORMAL 252.0625
----------------
Trimmed Data....
----------------
ORCL:ORCLDATA406 0 5 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA407 0 6 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA408 0 7 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA409 0 8 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA410 0 9 CLOSED PROVISIONED NORMAL 252.0625
ORCL:ORCLDATA411 0 10 CLOSED PROVISIONED NORMAL 252.0625
NOTE: Disk’s path may differ as below since its depend on value of parameter’s ASM_DISKSTRING in ASM instance
NAME HEADER_STATU PATH
------------------------------ ------------ -------------------------------------------------
DR_DATA_CD_00_DBsGuru PROVISIONED /dev/oracleasm/disks/DBsguru_477 --
DR_DATA_CD_01_DBsGuru PROVISIONED /dev/oracleasm/disks/DBsguru_478
Step4: Before adding disk we have to check disk group size
> 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 EXTERN N 512 4096 1048576 32417788 4474595 0 4474595 0 N DATA/
MOUNTED EXTERN N 512 4096 1048576 8647 8082 0 8082 0 Y OCR/
MOUNTED EXTERN N 512 4096 1048576 414312 414017 0 414017 0 N ORAARCH/
MOUNTED EXTERN N 512 4096 1048576 1547813 1481144 0 1481144 0 N REDO/
SQL> select NAME,TOTAL_MB/(1024) TOTAL_GB,FREE_MB/1024 FREE_GB,(TOTAL_MB-FREE_MB)/1024 USED_GB,(FREE_MB/TOTAL_MB)*100 FREE_PER from v$asm_diskgroup;
NAME TOTAL_GB FREE_GB USED_GB FREE_PER
------------------------------ ---------- ---------- ---------- ----------
DATA 31657.9961 4369.72168 27288.2744 13.8029004
OCR 8.44433594 7.89257813 .551757813 93.4659419
ORAARCH 404.601563 404.313477 .288085938 99.9287976
REDO 1511.53613 1446.42969 65.1064453 95.6926967
Step5: Create Dummy Disk Group called TESTDG to check disk are working fine.
In this step we create dummy Disk Group to test allocated disks are working fine. After successful creation / testing we will drop dummy Disk Group and add disk into +DATA Disk Group.
CREATE DISKGROUP TESTDG EXTERNAL REDUNDANCY DISK
'ORCL:ORCLDATA401',
'ORCL:ORCLDATA420',
'ORCL:ORCLDATA403',
'ORCL:ORCLDATA404',
'ORCL:ORCLDATA405',
'ORCL:ORCLDATA406',
'ORCL:ORCLDATA407',
'ORCL:ORCLDATA408',
'ORCL:ORCLDATA409',
'ORCL:ORCLDATA410',
'ORCL:ORCLDATA411',
'ORCL:ORCLDATA412',
'ORCL:ORCLDATA413',
'ORCL:ORCLDATA414',
'ORCL:ORCLDATA415',
'ORCL:ORCLDATA416',
'ORCL:ORCLDATA417',
'ORCL:ORCLDATA418',
'ORCL:ORCLDATA419',
'ORCL:ORCLDATA402'
ATTRIBUTE 'au_size'='1048576', 'compatible.asm'='11.2.0.0.0', 'compatible.rdbms'='11.2.0.0.0';
ALTER DISKGROUP TESTDG REBALANCE POWER 8;
Validate new created DG TESTDG.
SQL> alter diskgroup TESTDG check all;
NOTE: starting check of diskgroup TESTDG
GMON checking disk 0 for group 5 at 20 for pid 34, osid 1613
GMON checking disk 1 for group 5 at 21 for pid 34, osid 1613
GMON checking disk 2 for group 5 at 22 for pid 34, osid 1613
GMON checking disk 3 for group 5 at 23 for pid 34, osid 1613
GMON checking disk 4 for group 5 at 24 for pid 34, osid 1613
GMON checking disk 5 for group 5 at 25 for pid 34, osid 1613
GMON checking disk 6 for group 5 at 26 for pid 34, osid 1613
GMON checking disk 7 for group 5 at 27 for pid 34, osid 1613
GMON checking disk 8 for group 5 at 28 for pid 34, osid 1613
GMON checking disk 9 for group 5 at 29 for pid 34, osid 1613
GMON checking disk 10 for group 5 at 30 for pid 34, osid 1613
GMON checking disk 11 for group 5 at 31 for pid 34, osid 1613
GMON checking disk 12 for group 5 at 32 for pid 34, osid 1613
GMON checking disk 13 for group 5 at 33 for pid 34, osid 1613
GMON checking disk 14 for group 5 at 34 for pid 34, osid 1613
GMON checking disk 15 for group 5 at 35 for pid 34, osid 1613
GMON checking disk 16 for group 5 at 36 for pid 34, osid 1613
GMON checking disk 17 for group 5 at 37 for pid 34, osid 1613
GMON checking disk 18 for group 5 at 38 for pid 34, osid 1613
GMON checking disk 19 for group 5 at 39 for pid 34, osid 1613
SUCCESS: check of diskgroup TESTDG found no errors
Now we are good to drop disk group TESTDG.
alter diskgroup TESTDG mount;
alter diskgroup TESTDG dismount;
drop diskgroup TESTDG;
Step6 : In this step, we are adding newly allocated disks to DG DATA.
alter diskgroup DATA add disk 'ORCL:ORCLDATA951';
alter diskgroup DATA add disk 'ORCL:ORCLDATA952';
alter diskgroup DATA add disk 'ORCL:ORCLDATA953';
alter diskgroup DATA add disk 'ORCL:ORCLDATA954';
alter diskgroup DATA add disk 'ORCL:ORCLDATA955';
alter diskgroup DATA add disk 'ORCL:ORCLDATA956';
alter diskgroup DATA add disk 'ORCL:ORCLDATA957';
alter diskgroup DATA add disk 'ORCL:ORCLDATA958';
alter diskgroup DATA add disk 'ORCL:ORCLDATA959';
alter diskgroup DATA add disk 'ORCL:ORCLDATA960';
alter diskgroup DATA add disk 'ORCL:ORCLDATA961';
alter diskgroup DATA add disk 'ORCL:ORCLDATA962';
alter diskgroup DATA add disk 'ORCL:ORCLDATA963';
alter diskgroup DATA add disk 'ORCL:ORCLDATA964';
alter diskgroup DATA add disk 'ORCL:ORCLDATA965';
alter diskgroup DATA add disk 'ORCL:ORCLDATA966';
alter diskgroup DATA add disk 'ORCL:ORCLDATA967';
alter diskgroup DATA add disk 'ORCL:ORCLDATA968';
alter diskgroup DATA add disk 'ORCL:ORCLDATA969';
alter diskgroup DATA add disk 'ORCL:ORCLDATA970';
We can also add multiple disks into disk group in one go, below is example of adding disks into disk group along with rebalance.
ALTER DISKGROUP +DATA
ADD DISK '/dev/oracleasm/disks/DBsguru_477','/dev/oracleasm/disks/DBsguru_478' rebalance power 8;
Step7: After Addition of Disks to DG, Check Disk Group Size
SQL> select NAME,TOTAL_MB/(1024) TOTAL_GB,FREE_MB/1024 FREE_GB,(TOTAL_MB-FREE_MB)/1024 USED_GB,(FREE_MB/TOTAL_MB)*100 FREE_PER from v$asm_diskgroup;
NAME TOTAL_GB FREE_GB USED_GB FREE_PER
------------------------------ ---------- ---------- ---------- ----------
DATA 35840.1367 6279.42188 29560.7148 17.5206415
OCR 67.4296875 66.8779297 .551757813 99.1817287
ORAARCH 2048.00781 1393.33203 654.675781 68.0335311
REDO 3034.33594 2969.47559 64.8603516 97.8624532
Step8: Rebalance
We are doing rebalance manually, because default value is 1.
Using gv$asm_operation, we will monitor rebalance status, if we get No Rows select output that means rebalance completed.
ALTER DISKGROUP DATA REBALANCE POWER 8;
select*from gv$asm_operation.
Step9: Once again we will validate space of DG DATA and upon successful completion of activities, we are good to create new tablespace and user then assign default new tablespace to newly created user.
SQL> select NAME,TOTAL_MB/(1024) TOTAL_GB,FREE_MB/1024 FREE_GB,(TOTAL_MB-FREE_MB)/1024 USED_GB,(FREE_MB/TOTAL_MB)*100 FREE_PER from v$asm_diskgroup;
NAME TOTAL_GB FREE_GB USED_GB FREE_PER
------------------------------ ---------- ---------- ---------- ----------
DATA 35840.1367 6279.42188 29560.7148 17.5206415
OCR 67.4296875 66.8779297 .551757813 99.1817287
ORAARCH 2048.00781 1393.33203 654.675781 68.0335311
REDO 3034.33594 2969.47559 64.8603516 97.8624532
This document is only for learning purpose and always validate in the LAB environment first before applying in the LIVE environment.
Hope so you like this article!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the latest update. Click here to know more about our pursuit.
Thanks for such a wonderful article.
Thanks Krishna for valuable feedback & review!