I must thank my fellow DBA Franky Weber Faust for his publication in his blog.
The goal here is to introduce how to create a disk group with one of the new features of Oracle ASM in version 12.2.0.1, the Flex Redundancy or Flex Disk Group.
This new type of Disk Group redundancy in ASM allows us to isolate databases at different levels of redundancy. For example, PROD_PDB will have High Redundancy, while HML_PDB and DEV_PDB will have Normal Redundancy.
Let’s go step by step …
Initially I introduce new disks to ASM using the Filter Driver
[root@london1 ~]# . oraenv ORACLE_SID = [root] ? +ASM1 The Oracle base has been set to /u01/app/oracle [root@london1 ~]# asmcmd ASMCMD> afd_label FLEX01 /dev/sdg ASMCMD> afd_label FLEX02 /dev/sdh ASMCMD> afd_label FLEX03 /dev/sdi ASMCMD> afd_label FLEX04 /dev/sdj ASMCMD> afd_label FLEX05 /dev/sdk
We list the disks to check the newly added:
ASMCMD> afd_lslbl -------------------------------------------------------------------------------- Label Duplicate Path ================================================================================ CONFIG01 /dev/sdb CONFIG02 /dev/sdc CONFIG03 /dev/sdd CONFIG04 /dev/sde DATA01 /dev/sdf FLEX01 /dev/sdg FLEX02 /dev/sdh FLEX03 /dev/sdi FLEX04 /dev/sdj FLEX05 /dev/sdk ASMCMD> exit
When you exit ASMCMD switch your session to the oracle user and set the environment variables again to the + ASM1 instance and access SQL * Plus:
[root@london1 ~]# su - oracle Last login: Mon Jul 31 23:22:56 BRT 2017 [oracle@london1 ~]$ . oraenv ORACLE_SID = [orcl1] ? +ASM1 The Oracle base remains unchanged with value /u01/app/oracle [oracle@london1 ~]$ sqlplus / as sysasm SQL*Plus: Release 12.2.0.1.0 Production on Mon Jul 31 23:23:24 2017 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production After that, let's create a new disk group with these disks: SQL> create diskgroup FLEX flex redundancy disk 'AFD:FLEX01', 'AFD:FLEX02', 'AFD:FLEX03'; Diskgroup created.
To use Flex redundancy requires at least 3 Failure Groups, therefore 3 disks.
Note that in the build command I did not report any Failure Group, but by default ASM creates one for each of the disks. Let’s see:
SQL> select group_number, name, path, label, state, mount_status, header_status, total_mb, free_mb, library, failgroup, voting_file from v$asm_disk; GROUP_NUMBER NAME PATH LABEL STATE MOUNT_S HEADER_STATU TOTAL_MB FREE_MB LIBRARY FAILGROUP V ------------ ---------- --------------- ---------- -------- ------- ------------ ---------- ---------- ---------------------------------------------------------------- ------------------------------ - 0 AFD:FLEX04 FLEX04 NORMAL CLOSED PROVISIONED 0 0 AFD Library - Generic , version 3 (KABI_V3) N 0 AFD:FLEX05 FLEX05 NORMAL CLOSED PROVISIONED 0 0 AFD Library - Generic , version 3 (KABI_V3) N 1 CONFIG01 AFD:CONFIG01 CONFIG01 NORMAL CACHED MEMBER 10240 1724 AFD Library - Generic , version 3 (KABI_V3) CONFIG01 N 1 CONFIG02 AFD:CONFIG02 CONFIG02 NORMAL CACHED MEMBER 10240 1696 AFD Library - Generic , version 3 (KABI_V3) CONFIG02 Y 1 CONFIG03 AFD:CONFIG03 CONFIG03 NORMAL CACHED MEMBER 10240 1732 AFD Library - Generic , version 3 (KABI_V3) CONFIG03 N 1 CONFIG04 AFD:CONFIG04 CONFIG04 NORMAL CACHED MEMBER 10240 1716 AFD Library - Generic , version 3 (KABI_V3) CONFIG04 N 2 DATA01 AFD:DATA01 DATA01 NORMAL CACHED MEMBER 12288 8160 AFD Library - Generic , version 3 (KABI_V3) DATA01 N 3 FLEX01 AFD:FLEX01 FLEX01 NORMAL CACHED MEMBER 1024 920 AFD Library - Generic , version 3 (KABI_V3) FLEX01 N 3 FLEX02 AFD:FLEX02 FLEX02 NORMAL CACHED MEMBER 1024 920 AFD Library - Generic , version 3 (KABI_V3) FLEX02 N 3 FLEX03 AFD:FLEX03 FLEX03 NORMAL CACHED MEMBER 1024 920 AFD Library - Generic , version 3 (KABI_V3) FLEX03 N 10 rows selected.
And Disk Group looks like this:
SQL> select GROUP_NUMBER, NAME, STATE, TYPE, TOTAL_MB, FREE_MB, REQUIRED_MIRROR_FREE_MB, USABLE_FILE_MB from v$asm_diskgroup; GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB ------------ -------- ----------- ------ ---------- ---------- ----------------------- -------------- 1 CONFIG MOUNTED EXTERN 40960 6868 0 6868 2 DATA MOUNTED EXTERN 12288 8160 0 8160 3 FLEX MOUNTED FLEX 3072 2760 0 0 3 rows selected.
Let’s delete Disk Group to create it again:
SQL> drop diskgroup FLEX; Diskgroup dropped. Note that when you try to create with 4 disks, but only 2 Failure Groups, the error occurs: SQL> create diskgroup FLEX flex redundancy 2 failgroup FG_A disk 'AFD:FLEX01', 'AFD:FLEX03' 3 failgroup FG_B disk 'AFD:FLEX02', 'AFD:FLEX04'; create diskgroup FLEX flex redundancy * ERROR at line 1: ORA-15018: diskgroup cannot be created ORA-15167: command requires at least 3 failure groups; found only 2
Then we include the 3 disks and create again specifying the path of each disk and also their respective Failure Groups:
SQL> create diskgroup FLEX flex redundancy 2 failgroup FG_A disk 'AFD:FLEX01' 3 failgroup FG_B disk 'AFD:FLEX02' 4 failgroup FG_C disk 'AFD:FLEX03'; Diskgroup created.
Since we have 5 disks we will use the remaining 2 and add them in separate Failure Groups:
SQL> alter diskgroup FLEX add 2 failgroup FG_D disk 'AFD:FLEX04' 3 failgroup FG_E disk 'AFD:FLEX05'; Diskgroup altered.
We list the disks again to see how it was after we all used them:
SQL> select group_number, name, path, label, state, mount_status, header_status, total_mb, free_mb, library, failgroup, voting_file from v$asm_disk; GROUP_NUMBER NAME PATH LABEL STATE MOUNT_S HEADER_STATU TOTAL_MB FREE_MB LIBRARY FAILGROUP V ------------ ---------- --------------- ---------- -------- ------- ------------ ---------- ---------- ---------------------------------------------------------------- ------------------------------ - 1 CONFIG01 AFD:CONFIG01 CONFIG01 NORMAL CACHED MEMBER 10240 1724 AFD Library - Generic , version 3 (KABI_V3) CONFIG01 N 1 CONFIG02 AFD:CONFIG02 CONFIG02 NORMAL CACHED MEMBER 10240 1696 AFD Library - Generic , version 3 (KABI_V3) CONFIG02 Y 1 CONFIG03 AFD:CONFIG03 CONFIG03 NORMAL CACHED MEMBER 10240 1732 AFD Library - Generic , version 3 (KABI_V3) CONFIG03 N 1 CONFIG04 AFD:CONFIG04 CONFIG04 NORMAL CACHED MEMBER 10240 1716 AFD Library - Generic , version 3 (KABI_V3) CONFIG04 N 2 DATA01 AFD:DATA01 DATA01 NORMAL CACHED MEMBER 12288 8160 AFD Library - Generic , version 3 (KABI_V3) DATA01 N 3 FLEX01 AFD:FLEX01 FLEX01 NORMAL CACHED MEMBER 1024 952 AFD Library - Generic , version 3 (KABI_V3) FG_A N 3 FLEX02 AFD:FLEX02 FLEX02 NORMAL CACHED MEMBER 1024 948 AFD Library - Generic , version 3 (KABI_V3) FG_B N 3 FLEX03 AFD:FLEX03 FLEX03 NORMAL CACHED MEMBER 1024 956 AFD Library - Generic , version 3 (KABI_V3) FG_C N 3 FLEX04 AFD:FLEX04 FLEX04 NORMAL CACHED MEMBER 1024 952 AFD Library - Generic , version 3 (KABI_V3) FG_D N 3 FLEX05 AFD:FLEX05 FLEX05 NORMAL CACHED MEMBER 1024 952 AFD Library - Generic , version 3 (KABI_V3) FG_E N 10 rows selected.
Finally we verified how the distribution of the space in the Disk Groups was:
SQL> select GROUP_NUMBER, NAME, STATE, TYPE, TOTAL_MB, FREE_MB, REQUIRED_MIRROR_FREE_MB, USABLE_FILE_MB from v$asm_diskgroup; GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB ------------ ---------- ----------- ------ ---------- ---------- ----------------------- -------------- 1 CONFIG MOUNTED EXTERN 40960 6868 0 6868 2 DATA MOUNTED EXTERN 12288 8160 0 8160 3 FLEX MOUNTED FLEX 5120 4760 0 0 3 rows selected.
In the next post we will see how to use this Flex Disk Group.