Tags

11g (5) 12c (6) 18c (3) 19c (4) ASM (1) Critical Patch (11) Data Pump (1) Dataguard (9) Diverse (3) GRID (7) GitLab (2) Linux (8) OEM (2) ORA Errors (13) Oracle (12) RMAN (4)

Saturday, May 15, 2021

Remove online disk from ASM diskgroup


Remove online disk from ASM diskgroup


Scope of the documet is to remove the DATAC_0022 which has been created by accidentally with 500MB instead of 500GB

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

First, try to get the detail, which are required by using the following command.

Login to the ASM Instance

sqlplus / as sysasm
col diskgroup for a10
col diskname for a12
col path for a50
set linesize 200;
setpagesize 100;
select a.name DiskGroup,b.name DiskName, b.total_mb, b.free_mb,b.path, b.header_status
from v$asm_disk b, v$asm_diskgroup a where a.group_number (+) =b.group_number order by
b.group_number,b.name;                    

DISKGROUP  DISKNAME       TOTAL_MB    FREE_MB PATH                                               HEADER_STATU
---------- ------------ ---------- ---------- --------------------------------------------------                       ------------
...
...
DATAC       DATAC_0021        500000      65621 /dev/mapper/kardbprd_49                       MEMBER
DATAC       DATAC_0022           500          0 /dev/mapper/kardbprd_50                               MEMBER
DATAD       DATAD_0000        511993       1645 /dev/mapper/kardbprd_10                       MEMBER
DATAD       DATAD_0001        511993       1631 /dev/mapper/kardbprd_11                       MEMBER
...
...





select group_number, disk_number, name, total_mb, free_mb, path
from v$asm_disk;

GROUP_NUMBER DISK_NUMBER NAME                             TOTAL_MB    FREE_MB PATH
------------ ----------- ------------------------------ ---------- ---------- --------------------------------
...
...

           7           3 KARDBPRDASM01_0003                500000      19138 /dev/mapper/kardbprd_04
           7           2 KARDBPRDASM01_0002                500000      19135 /dev/mapper/kardbprd_03
           3          22 DATAC_0022                             500          0 /dev/mapper/kardbprd_50
           3          21 DATAC_0021                          500000      65621 /dev/mapper/kardbprd_49
           7           6 KARDBPRDASM01_0006                500000      19140 /dev/mapper/kardbprd_07
...
...


select group_number, name, total_mb, free_mb from v$asm_diskgroup ;

GROUP_NUMBER NAME                             TOTAL_MB    FREE_MB
------------ ------------------------------ ---------- ----------
           1 DATAA                               511993     118415
           3 DATAC                             12229278     289242
           2 DATAB                              2016790       3773
           5 DATAE                              2728783       3753
           4 DATAD                              3628779      11524
           .....
           .....

Now, I request ASM to move all data from DATAC_0022 to the +DATAC and remove those them from the group.


Login to the ASM Instance
sqlplus / as sysasm

The command also allows specifying a speed of the operation
The speed number is a number from 0 to 11 where 0 stops rebalancing and 11 means full speed
alter diskgroup <name> drop disk <disks names> rebalance power <speed number>

alter diskgroup DATAC drop DATAC_0022 rebalance power 11;

Monitor a progress by querying v$asm_operation.

select group_number, operation, state, est_minutes;

Once the query stops return REBAL rows I confirm completion of dropping the disks by quering v$asm_disk view.
select group_number, disk_number, name, total_mb, free_mb, path, header_status from v$asm_disk

HEADER_STATUS is FORMER which means that the disks were properly deleted from the diskgroup. You can also notice GROUP_NUMBER=0 so they no longer belongs to +DATAC.

Extra command:
To check Diskgroup mapped to which instance, Db name & Compatible.
SELECT dg.name AS diskgroup, SUBSTR(c.instance_name,1,12) AS instance,
SUBSTR(c.db_name,1,12) AS dbname, SUBSTR(c.SOFTWARE_VERSION,1,12) AS software, SUBSTR(c.COMPATIBLE_VERSION,1,12) AS compatible
FROM V$ASM_DISKGROUP dg, V$ASM_CLIENT c WHERE dg.group_number =c.group_number;

DISKGROUP  INSTANCE     DBNAME   SOFTWARE     COMPATIBLE
---------- ------------ -------- ------------ ------------
DATA       emcdb        emcdb    18.0.0.0.0   18.0.0.0.0
DATA       +ASM         +ASM     18.0.0.0.0   18.0.0.0.0

No comments:

Post a Comment

physical standby without duplicate command

physical standby without duplicate command create a physical standby database using RMAN without using duplicate command PURPOSE:   All docu...