Flex ASM diskgroup in 12.2 Oracle

Flex ASM diskgroup in 12.2 Oracle

Flex Diskgroups are included new features as quotas, cloning and filegroups.
File groups are a logical container within a flex disk-group and different properties such as redundancy and rebalance can be set at and changed at the filegroup level. It doesn’t have fail-over group as Normal or High Redundancy.
A major benefit of file groups is the ability to have a different availability specification for each database that shares the same disk group.

Example
If you wanted to have normal redundancy for some databases, and high redundancy for others you need to create two “data” disk groups for full-fill your requirement.
In Flex diskgroup you can now have a disk group containing 2 databases for example, out of which database 1 uses normal redundancy, and database 2 uses high redundancy.

Understand databases, diskgroup, filegroup and quotas relate
Oracle ASM flex disk group is a disk group type that supports Oracle ASM file groups and quota groups.
File group is a group of files that share the same set of properties and characteristics.
A quota group defines the quota allocated to a group of Oracle ASM File Groups. A file group belongs to only one quota group.
each file group of the flex disk group has its own redundancy property setting
flex disk group generally tolerates two failures, the same as a HIGH redundancy disk group

Note:
COMPATIBLE.ASM attribute determines the minimum software version for an Oracle ASM instance that can use the disk group.
COMPATIBLE.RDBMS attribute determines the minimum COMPATIBLE database initialization parameter setting for any database instance that is allowed to use the disk group.
COMPATIBLE.ADVM attribute determines whether the disk group can contain Oracle ADVM volumes. value must be set to 11.2 or higher

Create the FLEX Diskgroup
For creating the FLEX you should have minimum 3 disk group as similar to high redundancy and compatible parameter need to be set at 12.2 version.

CREATE DISKGROUP data FLEX REDUNDANCY DISK '/dev/oracle/data1','/dev/oracle/data2','/dev/oracle/data3'
ATTRIBUTE
'compatible.asm' = '12.2.0.2.0',
'compatible.rdbms' = '12.2.0.2.0',
'compatible.advm' = '12.2.0.2.0';

Convert the Normal or High redundancy Diskgroup to FLEX Diskgroup
For migrating to a flex disk group, the disk group must have a minimum of three failure groups.

--Change the compatible attributes of the disk-groups to 12.2.
ALTER DISKGROUP data3 SET ATTRIBUTE 'compatible.asm' = '12.2';
ALTER DISKGROUP data3 SET ATTRIBUTE 'compatible.rdbms' = '12.2',
ALTER DISKGROUP data3 SET ATTRIBUTE 'compatible.advm' = '12.2';

-- Mount the diskgroup in restricted mode.
ALTER DISKGROUP data MOUNT RESTRICTED;

-- Convert into flex mode
ALTER DISKGROUP data CONVERT REDUNDANCY TO FLEX;

Check attribute and compatibility parameter of diskgroup

SELECT SUBSTR(dg.name,1,12) AS diskgroup, SUBSTR(a.name,1,24) AS name,
SUBSTR(a.value,1,24) AS value FROM V$ASM_DISKGROUP dg,
V$ASM_ATTRIBUTE a WHERE dg.name = 'DATA' AND dg.group_number =
a.group_number AND a.name NOT LIKE '%template%';

DISKGROUP NAME                     VALUE      
--------- ------------------------ -----------
DATA      thin_provisioned         FALSE      
DATA      access_control.umask     066        
DATA      phys_meta_replicated     true       
DATA      disk_repair_time         3.6h       
DATA      idp.boundary             auto       
DATA      idp.type                 dynamic    
DATA      content.type             data       
DATA      content.check            FALSE      
DATA      au_size                  1048576    
DATA      sector_size              512        
DATA      compatible.asm           12.1.0.0.0 
DATA      compatible.rdbms         12.1.0.0.0 
DATA      compatible.advm          12.1.0.0.0 
DATA      cell.smart_scan_capable  FALSE      
DATA      access_control.enabled   FALSE      
DATA      failgroup_repair_time    24.0h      

Check disk present in diskgroup

SELECT SUBSTR(DG.NAME,1,16) AS DISKGROUP, SUBSTR(D.NAME,1,16) AS ASMDISK,
D.MOUNT_STATUS, D.STATE, SUBSTR(D.FAILGROUP,1,16) AS FAILGROUP
FROM V$ASM_DISKGROUP DG, V$ASM_DISK D WHERE DG.GROUP_NUMBER = D.GROUP_NUMBER;

Check client with diskgroup

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;

Check the type of diskgroup

SELECT NAME, OS_MB, FAILGROUP, PATH FROM V$ASM_DISK WHERE GROUP_NUMBER = 5;

 
NAME     OS_MB FAILGROUP     PATH
------ ------- ------------- ----------
FLEX1    10239 FLEX1         AFD:FLEX1
FLEX2    10239 FLEX2         AFD:FLEX2
FLEX3    10239 FLEX3         AFD:FLEX3
FLEX4    10239 FLEX4         AFD:FLEX4
FLEX5    10239 FLEX5         AFD:FLEX5

Adding a File Group to a Database

ALTER DISKGROUP DiskGroup_1 ADD FILEGROUP FileGroup_PDB1
DATABASE PDB1 SET 'quota_group' = 'QuotaGroup_QGRP1';

ALTER DISKGROUP DiskGroup_1 ADD FILEGROUP FileGroup_PDB2
DATABASE PDB2 SET 'quota_group' = 'QuotaGroup_QGRP2';

Modifying a File Group

ALTER DISKGROUP DiskGroup_1 MODIFY FILEGROUP FileGroup_PDB1
SET 'datafile.redundancy' = 'HIGH';

View used to fetch filegroup information

SELECT * FROM V$ASM_FILEGROUP;
SELECT * FROM V$ASM_FILEGROUP_PROPERTY;
SELECT * FROM V$ASM_FILEGROUP_FILE;

Create PDB in FLEX disk-group

--Set the flex diskgroup for datafile locations
ALTER SESSION SET DB_CREATE_FILE_DEST='+FLEX';

-- Create a pluggable database
CREATE PLUGGABLE DATABASE PDB1 ADMIN USER PDBADMIN IDENTIFIED BY ORACLE
DEFAULT TABLESPACE PDB1TBS DATAFILE SIZE 200M AUTOEXTEND OFF STORAGE (MAXSIZE 800M);

-- Open the pluggable database
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;

-- Check the file path
SELECT C.NAME CONTAINER, D.FILE_NAME, BYTES/1024/1024 SIZE_MB
FROM V$CONTAINERS C, CDB_DATA_FILES D
WHERE C.CON_ID=D.CON_ID AND C.NAME='PDB1'

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.