ASM: Create/Drop Diskgroup

Overview using force option with mount,dismount drop and create DG

  Mount force
  The force option becomes a must when a disk group mount reports missing disks. This is one of the cases when 
  it's safe and required to use the force option. Provided we are not missing too many disks, the mount force 
  should succeed. Basically, at least one partner disk - from every disk partnership in the disk group - must 
  be available.

  Create Diskgroup force 
  If the disk to be added to a disk group is not CANDIDATE, PROVISIONED or FORMER, I have to specify force next 
  to the disk name. This will destroy the data on that specified disk(s).

  Forcing disk group drop
  To drop a disk group I have to mount it first. If I cannot mount a disk group, but must drop it, I can use the 
  force option of the DROP DISKGROUP statement, like this:
  SQL> drop diskgroup PLAY force including contents;

  Forcing disk group dismount
  ASM does not allow a disk group to be dismounted if it's still being accessed. But I can force the disk group 
  dismount even if some files in the disk group are open. Here is an example:
  SQL> alter diskgroup PLAY dismount;
  alter diskgroup PLAY dismount
  *
  ERROR at line 1:
  ORA-15032: not all alterations performed
  ORA-15027: active use of diskgroup "PLAY" precludes its dismount

  Note that the forced disk group dismount will cause all datafiles in that database to go offline, which means they 
  will need recovery (and restore if I drop disk group PLAY)

  For details please read

Collect DG status

SQL> select dg.inst_id, dg.name dg_name,  dg.state dg_state,  dg.type,d.name, d.DISK_NUMBER dsk_no, d.MOUNT_STATUS, d.HEADER_STATUS, d.MODE_STATUS,
        d.STATE, d. PATH, d.FAILGROUP  FROM GV$ASM_DISK d,  Gv$asm_diskgroup dg
     where dg.inst_id=d.inst_id and  dg.group_number(+)=d.group_number and    dg.name=:dg_name order by inst_id, dsk_no;

   INST_ID DG_NAME    DG_STATE     TYPE         NAME         DSK_NO MOUNT_S HEADER_STATU MODE_ST STATE      PATH                 FAILGROUP
---------- ---------- ---------- --------------- ---------- ------- ------- ------------ ------- -------- ------------------------------ ---------------
     1 TEST_NEW   MOUNTED     NORMAL      TEST_0000      0 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk1     TEST_0000
     1 TEST_NEW   MOUNTED     NORMAL      TEST_0001      1 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk2     TEST_0001
     2 TEST_NEW   MOUNTED     NORMAL      TEST_0000      0 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk1     TEST_0000
     2 TEST_NEW   MOUNTED     NORMAL      TEST_0001      1 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk2     TEST_0001
     3 TEST_NEW   MOUNTED     NORMAL      TEST_0000      0 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk1     TEST_0000
     3 TEST_NEW   MOUNTED     NORMAL      TEST_0001      1 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk2     TEST_0001

SQL> select    g.name disk_grp, o.group_number, operation , est_minutes from gv$asm_operation o,    v$asm_diskgroup g
         where g.group_number = o.group_number;
no rows selected
  --> No outstanding Rebalance operations 

SQL> select f.inst_id, f.group_number, file_number, compound_index, incarnation, f.block_size, bytes/1024/1024/1024 GB, f.type, striped,
         creation_date, modification_date from gv$asm_file f  , Gv$asm_diskgroup dg where f.group_number = dg.group_number and
          dg.inst_id=f.inst_id and dg.name=:dg_name;
   INST_ID GROUP_NUMBER FILE_NUMBER COMPOUND_INDEX INCARNATION BLOCK_SIZE      GB TYPE         STRIPE CREATION_ MODIFICAT
---------- ------------ ----------- -------------- ----------- ---------- ---------- --------------- ------ --------- ---------
     1             6     256     100663552   852905863         8192 .004890442 DATAFILE         COARSE 14-JUL-14 14-JUL-14
     2             6     256     100663552   852905863         8192 .004890442 DATAFILE         COARSE 14-JUL-14 14-JUL-14
     3             6     256     100663552   852905863         8192 .004890442 DATAFILE         COARSE 14-JUL-14 14-JUL-14
--> DG holds only a single Datafile 
SQL> select c.INST_ID, dg.name DGName, c.GROUP_NUMBER, INSTANCE_NAME, DB_NAME,    STATUS,       SOFTWARE_VERSION ,COMPATIBLE_VERSION
        from Gv$asm_client c , Gv$asm_diskgroup dg  where dg.inst_id=c.inst_id and  dg.group_number=c.group_number;

   INST_ID DGNAME    GROUP_NUMBER INSTANCE_N DB_NAME    STATUS    SOFTWARE_VERSION     COMPATIBLE_VERSION
---------- ------------------------- ----- ------------ ---------- -------- ------------ -------------------- --------------------
     1      DATA                  1  +ASM1     +ASM      CONNECTED    11.2.0.4.0         11.2.0.4.0
     1      DATA                  1  grac41     grac4    CONNECTED    11.2.0.4.0         11.2.0.4.0
     1      FRA2                  2  grac41     grac4    CONNECTED    11.2.0.4.0         11.2.0.4.0
     1      OCR                   4  +ASM1      +ASM     CONNECTED    11.2.0.4.0         11.2.0.4.0
     2      DATA                  1  grac42      grac4   CONNECTED    11.2.0.4.0         11.2.0.4.0
     2      DATA                  1  +ASM2      +ASM     CONNECTED    11.2.0.4.0         11.2.0.4.0
     2      FRA2                  2  grac42      grac4   CONNECTED    11.2.0.4.0         11.2.0.4.0
     2      OCR                   4  +ASM2      +ASM     CONNECTED    11.2.0.4.0         11.2.0.4.0
     3      DATA                  1  grac43      grac4   CONNECTED    11.2.0.4.0         11.2.0.4.0
     3      DATA                  1  +ASM3      +ASM     CONNECTED    11.2.0.4.0         11.2.0.4.0
     3      FRA2                  2  grac43     grac4    CONNECTED    11.2.0.4.0         11.2.0.4.0
     3      OCR                   4  +ASM3      +ASM     CONNECTED    11.2.0.4.0         11.2.0.4.0
12 rows selected.
--> No client access this DG 

Check cluster resources
# crsi
NAME                           TARGET     STATE           SERVER       STATE_DETAILS   
-------------------------      ---------- ----------      ------------ ------------------
..
ora.TEST_NEW.dg                ONLINE     ONLINE          grac41        
ora.TEST_NEW.dg                ONLINE     ONLINE          grac42        
ora.TEST_NEW.dg                ONLINE     ONLINE          grac43        

or 

[oracle@grac41 ~]$  srvctl status diskgroup  -g TEST_NEW
Disk Group TEST_NEW is running on grac42,grac43,grac41

 

Drop an used DG using  dismount force and drop DG force option

DG Status :

SQL> select dg.inst_id, dg.name dg_name,  dg.state dg_state,  dg.type,d.name, d.DISK_NUMBER dsk_no, d.MOUNT_STATUS, d.HEADER_STATUS, d.MODE_STATUS,
        d.STATE, d. PATH, d.FAILGROUP  FROM GV$ASM_DISK d,  Gv$asm_diskgroup dg
     where dg.inst_id=d.inst_id and  dg.group_number(+)=d.group_number and    dg.name=:dg_name order by inst_id, dsk_no;

   INST_ID DG_NAME    DG_STATE     TYPE         NAME         DSK_NO MOUNT_S HEADER_STATU MODE_ST STATE      PATH                 FAILGROUP
---------- ---------- ---------- --------------- ---------- ------- ------- ------------ ------- -------- ------------------------------ ---------------
     1 ACFS       MOUNTED     NORMAL      ACFS_DISK1      0 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk1     ACFS_000
     1 ACFS       MOUNTED     NORMAL      ACFS_DISK2      1 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk2     ACFS_001
     2 ACFS       MOUNTED     NORMAL      ACFS_DISK1      0 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk1     ACFS_000
     2 ACFS       MOUNTED     NORMAL      ACFS_DISK2      1 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk2     ACFS_001
     3 ACFS       MOUNTED     NORMAL      ACFS_DISK1      0 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk1     ACFS_000
     3 ACFS       MOUNTED     NORMAL      ACFS_DISK2      1 CACHED  MEMBER     ONLINE  NORMAL   /dev/asm_test_1G_disk2     ACFS_001
--> Diskgroup ACFS is mounted by all RAC nodes 

SQL> select    g.name disk_grp, o.group_number, operation , est_minutes from gv$asm_operation o,    v$asm_diskgroup g
         where g.group_number = o.group_number;
--> No rebalancing action in progress 

SQL> select f.inst_id, f.group_number, file_number, compound_index, incarnation, f.block_size, bytes/1024/1024/1024 GB, f.type, striped,
         creation_date, modification_date from gv$asm_file f  , Gv$asm_diskgroup dg where f.group_number = dg.group_number and
          dg.inst_id=f.inst_id and dg.name=:dg_name;

   INST_ID GROUP_NUMBER FILE_NUMBER COMPOUND_INDEX INCARNATION BLOCK_SIZE      GB TYPE         STRIPE CREATION_ MODIFICAT
---------- ------------ ----------- -------------- ----------- ---------- ---------- --------------- ------ --------- ---------
     1          3     256      50331904   853603855         8192 .097663879 DATAFILE         COARSE 22-JUL-14 22-JUL-14
     2          3     256      50331904   853603855         8192 .097663879 DATAFILE         COARSE 22-JUL-14 22-JUL-14
     3          3     256      50331904   853603855         8192 .097663879 DATAFILE         COARSE 22-JUL-14 22-JUL-14
 --> only 1 Datafile is there - this file is used by all cluster nodes

SQL> select c.INST_ID, dg.name DGName, c.GROUP_NUMBER, INSTANCE_NAME, DB_NAME,    STATUS,       SOFTWARE_VERSION ,COMPATIBLE_VERSION
        from Gv$asm_client c , Gv$asm_diskgroup dg  where dg.inst_id=c.inst_id and  dg.group_number=c.group_number and dg.name=:dg_name;

   INST_ID DGNAME              GROUP_NUMBER INSTANCE_N DB_NAME  STATUS    SOFTWARE_VERSION     COMPATIBLE_VERSION
---------- ------------------------------ ------------ ---------- -------- ------------ -------------------- --------------------
     1 ACFS                      3 grac41      grac4    CONNECTED    11.2.0.4.0         11.2.0.4.0
     2 ACFS                      3 grac42      grac4    CONNECTED    11.2.0.4.0         11.2.0.4.0
     3 ACFS                      3 grac43      grac4    CONNECTED    11.2.0.4.0         11.2.0.4.0
-
OPEN files monitored by running : asmcmd lsof -G ACFS on all cluster nodes 
OPEN-Files  for DG: ACFS
grac41.example.com
DB_Name  Instance_Name  Path                                        
grac4    grac41         +acfs/grac4/datafile/acfs_ts.256.853603855  

grac42.example.com
DB_Name  Instance_Name  Path                                        
grac4    grac42         +acfs/grac4/datafile/acfs_ts.256.853603855  

grac43.example.com
DB_Name  Instance_Name  Path                                        
grac4    grac43         +acfs/grac4/datafile/acfs_ts.256.853603855  

Drop diskgroup ACFS
SQL> drop diskgroup ACFS ;
drop diskgroup ACFS
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15053: diskgroup "ACFS" contains existing files

SQL>  drop diskgroup ACFS force;
 drop diskgroup ACFS force
                         *
ERROR at line 1:
ORA-02000: missing INCLUDING keyword

SQL> drop diskgroup ACFS force including contents;
drop diskgroup ACFS force including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15230: diskgroup 'ACFS' does not require the FORCE option

Stop DG with force option
[grid@grac41 ASM]$  srvctl stop diskgroup -g ACFS -n grac43 -f
[grid@grac41 ASM]$  srvctl status diskgroup -g ACFS
Disk Group ACFS is not running

Drop diskgroup with force option 
SQL>  drop diskgroup ACFS  including contents;
 drop diskgroup ACFS  including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15001: diskgroup "ACFS" does not exist or is not mounted

SQL> drop diskgroup ACFS force including contents;
Diskgroup dropped. 

Cleanup Diskgroup Cluster resources

 Drop diskgroup resource with srvctl 
[grid@grac41 ASM]$ srvctl status diskgroup -g ACFS
Disk Group ACFS is not running

[grid@grac41 ASM]$ srvctl remove diskgroup -g ACFS
PRCA-1002 : Failed to remove CRS resource ora.ACFS.dg for ASM Disk Group ACFS
PRCR-1028 : Failed to remove resource ora.ACFS.dg
PRCR-1072 : Failed to unregister resource ora.ACFS.dg
CRS-0222: Resource 'ora.ACFS.dg' has dependency error.

[grid@grac41 ASM]$  crsctl status resource ora.grac4.db -p | grep -i  acfs
START_DEPENDENCIES=hard(ora.DATA.dg,ora.FRA2.dg,ora.ACFS.dg) weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) pullup(ora.DATA.dg,ora.FRA2.dg,ora.ACFS.dg)
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA.dg,shutdown:ora.FRA2.dg,shutdown:ora.ACFS.dg)

Remove start dependency:
[root@grac41 ~]# crsctl  modify resource  ora.grac4.db  -attr "START_DEPENDENCIES='hard(ora.DATA.dg,ora.FRA2.dg) 
                 weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) pullup(ora.DATA.dg,ora.FRA2.dg)' "
Check status :
[root@grac41 ~]#   crsctl status resource ora.grac4.db -p | grep -i acfs
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA.dg,shutdown:ora.FRA2.dg,shutdown:ora.ACFS.dg)

--> STOP DEPENDENCIES still there
Remove stop dependency:
[root@grac41 ~]# crsctl  modify resource  ora.grac4.db  -attr "STOP_DEPENDENCIES='hard(intermediate:ora.asm,shutdown:ora.DATA.dg,shutdown:ora.FRA2.dg)' "
[root@grac41 ~]# crsctl status resource ora.grac4.db -p | grep -i acfs 
--> START and STOP DEPENDENCIES for DG ACFS are removed now

Finally delete the DG resoure 
$ srvctl remove diskgroup -g ACFS 

[grid@grac41 ASM]$ srvctl status diskgroup -g ACFS
PRCA-1000 : ASM Disk Group ACFS does not exist
PRCR-1001 : Resource ora.ACFS.dg does not exist

One thought on “ASM: Create/Drop Diskgroup

  1. shaa

    Hi,

    my question is 1 particular disk is lost,what will happens to that diskgroup? does diskgroup goes to mount state? how to replace the d particular disk?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>