【Oracle 12c ASM专题】Flex磁盘组到底有多flexible?

前端之家收集整理的这篇文章主要介绍了【Oracle 12c ASM专题】Flex磁盘组到底有多flexible?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

原文链接https://martincarstenbach.wordpress.com/2017/08/22/12-2-new-feature-the-flex-asm-disk-group-part-4/

Flex Disk Group属性

前三部分我分享了关于ASM Flex Disk Group、File Group和Quota Group如何强制对存储空间进行限制的实验结果。但是我还没有测试修改磁盘组属性会产生什么效果。我所关心的属性都是数据保护级别相关的,正如官方文档中所讨论的那样-Automatic Storage Management Administrator’s Guide (https://docs.oracle.com/database/122/OSTMG/mirroring-diskgroup-redundancy.htm)。除了保护模式相关的属性之外当然也有其他的一些磁盘组属性,但是本次实验并不涉及。

一个Flex冗余度的ASM磁盘组可以被设置为任意保护模式(3副本、2副本、无保护),默认情况下,Flex冗余度的磁盘组使用2副本模式。不像其他的磁盘组,你可以改变Flex磁盘组内某个单独的DB或PDB的保护模式。这里最好给大家举个例子:

sql> select filegroup_number,name,guid from v$asm_filegroup

FILEGROUP_NUMBER NAME                 GUID
---------------- -------------------- --------------------------------
               0 DEFAULT_FILEGROUP
               1 CDB_CDB$ROOT         4700A987085A3DFAE05387E5E50A8C7B
               2 CDB_PDB$SEED         536DF51E8E28221BE0534764A8C0FD81
               3 PDB1                 537B677EF8DA0F1AE0534764A8C05729
               4 ORCL_CDB$ROOT        4700A987085A3DFAE05387E5E50A8C7B
               5 ORCL_PDB$SEED        537E63B952183748E0534764A8C09A7F
               6 PDB1_0001            537EB5B87E62586EE0534764A8C05530

7 rows selected.

上面的列表展示了我的ASM实例中的文件组信息。本章将要修改6号文件组(PDB1_0001)的属性,该文件组存放在Flex磁盘组上。知道哪些文件属于这个文件组非常重要。这里是一个列表:

sql> select file_number,bytes,space,type,redundancy,redundancy_lowered,striped,remirror
  2  from v$asm_file where filegroup_number = 6;

FILE_NUMBER  BYTES      SPACE      TYPE      REDUNDANCY  REDUNDANCY_LOWERED  STRIPED  REMIRROR
309          104865792  218103808  DATAFILE  MIRROR      U                   COARSE   N
310          262152192  541065216  DATAFILE  MIRROR      U                   COARSE   N
311          419438592  859832320  DATAFILE  MIRROR      U                   COARSE   N
312          67117056   142606336  TEMPFILE  MIRROR      U                   COARSE   N

官方文档说的没错,存放在Flex磁盘组上的数据文件默认冗余度是2副本。

文件属性

在磁盘组内部改变冗余度和其他一些属性都依赖于你拥有文件组。文件组的属性可以通过sql或者asmcmd来进行查看。如下:

ASMCMD> lsfg -G flex --filegroup PDB1_0001
File Group  Disk Group  Property    Value   File Type                  
PDB1_0001   FLEX        PRIORITY    MEDIUM                             
PDB1_0001   FLEX        STRIPING    COARSE  CONTAINER                  
PDB1_0001   FLEX        STRIPING    FINE    CONTROLFILE                
PDB1_0001   FLEX        REDUNDANCY  MIRROR  DATAFILE                   
PDB1_0001   FLEX        STRIPING    COARSE  DATAFILE                   
PDB1_0001   FLEX        REDUNDANCY  MIRROR  ONLINELOG                  
PDB1_0001   FLEX        STRIPING    COARSE  ONLINELOG                  
PDB1_0001   FLEX        REDUNDANCY  MIRROR  ARCHIVELOG                 
PDB1_0001   FLEX        STRIPING    COARSE  ARCHIVELOG                 
PDB1_0001   FLEX        REDUNDANCY  MIRROR  TEMPFILE                   
PDB1_0001   FLEX        STRIPING    COARSE  TEMPFILE                   
PDB1_0001   FLEX        REDUNDANCY  MIRROR  BACKUPSET                  
PDB1_0001   FLEX        STRIPING    COARSE  BACKUPSET                  
PDB1_0001   FLEX        REDUNDANCY  MIRROR  PARAMETERFILE              
PDB1_0001   FLEX        STRIPING    COARSE  PARAMETERFILE              
PDB1_0001   FLEX        REDUNDANCY  MIRROR  DATAGUARDCONFIG            
PDB1_0001   FLEX        STRIPING    COARSE  DATAGUARDCONFIG            
PDB1_0001   FLEX        REDUNDANCY  MIRROR  CHANGETRACKING             
PDB1_0001   FLEX        STRIPING    COARSE  CHANGETRACKING             
PDB1_0001   FLEX        REDUNDANCY  MIRROR  FLASHBACK                  
PDB1_0001   FLEX        STRIPING    COARSE  FLASHBACK                  
PDB1_0001   FLEX        REDUNDANCY  MIRROR  DUMPSET                    
PDB1_0001   FLEX        STRIPING    COARSE  DUMPSET                    
PDB1_0001   FLEX        REDUNDANCY  MIRROR  AUTOBACKUP                 
PDB1_0001   FLEX        STRIPING    COARSE  AUTOBACKUP                 
PDB1_0001   FLEX        REDUNDANCY  MIRROR  VOTINGFILE                 
PDB1_0001   FLEX        STRIPING    COARSE  VOTINGFILE                 
PDB1_0001   FLEX        REDUNDANCY  MIRROR  OCRFILE                    
PDB1_0001   FLEX        STRIPING    COARSE  OCRFILE                    
PDB1_0001   FLEX        REDUNDANCY  MIRROR  ASMVOL                     
PDB1_0001   FLEX        STRIPING    COARSE  ASMVOL                     
PDB1_0001   FLEX        REDUNDANCY  MIRROR  ASMVDRL                    
PDB1_0001   FLEX        STRIPING    COARSE  ASMVDRL                    
PDB1_0001   FLEX        REDUNDANCY  MIRROR  OCRBACKUP                  
PDB1_0001   FLEX        STRIPING    COARSE  OCRBACKUP                  
PDB1_0001   FLEX        REDUNDANCY  MIRROR  FLASHFILE                  
PDB1_0001   FLEX        STRIPING    COARSE  FLASHFILE                  
PDB1_0001   FLEX        REDUNDANCY  MIRROR  XTRANSPORT BACKUPSET       
PDB1_0001   FLEX        STRIPING    COARSE  XTRANSPORT BACKUPSET       
PDB1_0001   FLEX        REDUNDANCY  MIRROR  AUDIT_SPILLFILES           
PDB1_0001   FLEX        STRIPING    COARSE  AUDIT_SPILLFILES           
PDB1_0001   FLEX        REDUNDANCY  MIRROR  INCR XTRANSPORT BACKUPSET  
PDB1_0001   FLEX        STRIPING    COARSE  INCR XTRANSPORT BACKUPSET  
PDB1_0001   FLEX        REDUNDANCY  MIRROR  KEY_STORE                  
PDB1_0001   FLEX        STRIPING    COARSE  KEY_STORE                  
PDB1_0001   FLEX        REDUNDANCY  MIRROR  AUTOLOGIN_KEY_STORE        
PDB1_0001   FLEX        STRIPING    COARSE  AUTOLOGIN_KEY_STORE        
PDB1_0001   FLEX        REDUNDANCY  MIRROR  CONTAINER                  
PDB1_0001   FLEX        REDUNDANCY  HIGH    CONTROLFILE                
ASMCMD>

输出包含两大类属性:冗余和条带化。我真正关心的只有冗余度,而且我也没接触过条带化相关的属性。查了下官方文档 ASM Administrator’s guide(https://docs.oracle.com/database/122/OSTMG/asm-filegroups.htm#GUID-BE9083C8-A5DF-48CD-BB32-C8A6FCDA3E7B),
对条带化属性的解释如下:

这是文件类型的属性,仅需为每个文件类型设置。一般使用默认值就够了,不需要人为改变。

看到这个我很高兴。

使用sql依然可以达到这种效果,这里是等价的输出

sql> select file_type,value from v$asm_filegroup_property where filegroup_number = 6;

FILE_TYPE                      NAME                           VALUE
------------------------------ ------------------------------ ------------------------------
                               PRIORITY                       MEDIUM
CONTROLFILE                    REDUNDANCY                     HIGH
CONTROLFILE                    STRIPING                       FINE
DATAFILE                       REDUNDANCY                     MIRROR
DATAFILE                       STRIPING                       COARSE
ONLINELOG                      REDUNDANCY                     MIRROR
ONLINELOG                      STRIPING                       COARSE
ARCHIVELOG                     REDUNDANCY                     MIRROR
ARCHIVELOG                     STRIPING                       COARSE
TEMPFILE                       REDUNDANCY                     MIRROR
TEMPFILE                       STRIPING                       COARSE
BACKUPSET                      REDUNDANCY                     MIRROR
BACKUPSET                      STRIPING                       COARSE
PARAMETERFILE                  REDUNDANCY                     MIRROR
PARAMETERFILE                  STRIPING                       COARSE
DATAGUARDCONFIG                REDUNDANCY                     MIRROR
DATAGUARDCONFIG                STRIPING                       COARSE
CHANGETRACKING                 REDUNDANCY                     MIRROR
CHANGETRACKING                 STRIPING                       COARSE
FLASHBACK                      REDUNDANCY                     MIRROR
FLASHBACK                      STRIPING                       COARSE
DUMPSET                        REDUNDANCY                     MIRROR
DUMPSET                        STRIPING                       COARSE
AUTOBACKUP                     REDUNDANCY                     MIRROR
AUTOBACKUP                     STRIPING                       COARSE
VOTINGFILE                     REDUNDANCY                     MIRROR
VOTINGFILE                     STRIPING                       COARSE
OCRFILE                        REDUNDANCY                     MIRROR
OCRFILE                        STRIPING                       COARSE
ASMVOL                         REDUNDANCY                     MIRROR
ASMVOL                         STRIPING                       COARSE
ASMVDRL                        REDUNDANCY                     MIRROR
ASMVDRL                        STRIPING                       COARSE
OCRBACKUP                      REDUNDANCY                     MIRROR
OCRBACKUP                      STRIPING                       COARSE
FLASHFILE                      REDUNDANCY                     MIRROR
FLASHFILE                      STRIPING                       COARSE
XTRANSPORT BACKUPSET           REDUNDANCY                     MIRROR
XTRANSPORT BACKUPSET           STRIPING                       COARSE
AUDIT_SPILLFILES               REDUNDANCY                     MIRROR
AUDIT_SPILLFILES               STRIPING                       COARSE
INCR XTRANSPORT BACKUPSET      REDUNDANCY                     MIRROR
INCR XTRANSPORT BACKUPSET      STRIPING                       COARSE
KEY_STORE                      REDUNDANCY                     MIRROR
KEY_STORE                      STRIPING                       COARSE
AUTOLOGIN_KEY_STORE            REDUNDANCY                     MIRROR
AUTOLOGIN_KEY_STORE            STRIPING                       COARSE
CONTAINER                      REDUNDANCY                     MIRROR
CONTAINER                      STRIPING                       COARSE

49 rows selected.

除了v asmfile@H_426_301@v asm_filegroup_file这个视图:

sql> select filegroup_number,file_number,incarnation
  2  from v$asm_filegroup_file
  3  where filegroup_number = 6
  4  order by file_number;

FILEGROUP_NUMBER FILE_NUMBER INCARNATION
---------------- ----------- -----------
               6         309   948464269
               6         310   948464269
               6         311   948464269
               6         312   948464283

sql>

FILE_NUMBER字段和INCARNATION可以被关联上v$asm_file。

回到主题上:我想把冗余度从normal转为high,但该操作仅对6号文件组有效。v$asm_file视图中有一些大小、类型、当前冗余度、条带级别和是否正在re-mirror的信息。在进行操作之前,我们先看下里面的内容

sql> select file_number,remirror
  2  from v$asm_file where filegroup_number = 6;

FILE_NUMBER      BYTES      SPACE TYPE                 REDUND R STRIPE R
----------- ---------- ---------- -------------------- ------ - ------ -
        309  104865792  218103808 DATAFILE             MIRROR U COARSE N
        310  262152192  541065216 DATAFILE             MIRROR U COARSE N
        311  419438592  859832320 DATAFILE             MIRROR U COARSE N
        312   67117056  142606336 TEMPFILE             MIRROR U COARSE N

sql>

文件309和312使用mirror的冗余度(2副本,也就是normal冗余)。让我们尝试改变这个冗余度,看看会发生什么。

修改数据文件冗余度

这里真正的操作才开始。Automatic Storage Management Administrator’s Guide的Administering Oracle ASM Disk Groups章节的Managing Oracle ASM Flex Disk Groups这个部分(https://docs.oracle.com/database/122/OSTMG/asm-filegroups.htm#GUID-BE9083C8-A5DF-48CD-BB32-C8A6FCDA3E7B
说了所有文件组的属性都可以被修改。让我们用文档上的例子,来改变6号文件组的属性

sql> alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy'='high';

Diskgroup altered.

这条命令(其他改变存储属性的操作)必须以SYSASM方式登陆ASM实例才可以执行。从DB实例执行会报如下错误

sql> alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy' = 'high';

Error starting at line : 1 in command -
alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy' = 'high'
Error report -
ORA-15000: command disallowed by current instance type
15000. 00000 -  "command disallowed by current instance type"
*Cause:    The user has issued a command to a conventional RDBMS instance
           that is only appropriate for an ASM instance. Alternatively,the
           user has issued a command to an ASM instance that is only
           appropriate for an RDBMS instance.
*Action:   Connect to the correct instance type and re-issue the command.
sql>

命令结束后,数据文件立刻开始了re-mirror操作。在re-mirror的过程中(即remirror字段为Y),冗余度依然为MIRROR。只有当re-mirror操作完成后(即remirror字段为N),冗余度才变为high。注意:312号文件的冗余度依然为normal,想想也对,我们修改的是datafile.redundancy,而312号文件是临时文件

sql> select file_number,remirror
  2  from v$asm_file where filegroup_number = 6;

FILE_NUMBER      BYTES      SPACE TYPE                 REDUND R STRIPE R
----------- ---------- ---------- -------------------- ------ - ------ -
        309  104865792  339738624 DATAFILE             MIRROR U COARSE Y
        310  262152192  805306368 DATAFILE             MIRROR U COARSE Y
        311  419438592 1283457024 DATAFILE             MIRROR U COARSE Y
        312   67117056  142606336 TEMPFILE             MIRROR U COARSE N

sql> select file_number,remirror
  2  from v$asm_file where filegroup_number = 6;

FILE_NUMBER      BYTES      SPACE TYPE                 REDUND R STRIPE R
----------- ---------- ---------- -------------------- ------ - ------ -
        309  104865792  339738624 DATAFILE             HIGH   U COARSE N
        310  262152192  805306368 DATAFILE             HIGH   U COARSE N
        311  419438592 1283457024 DATAFILE             HIGH   U COARSE N
        312   67117056  142606336 TEMPFILE             MIRROR U COARSE N

为了让实验结果更详细,我下面还列了ASM实例警告日志中的相关信息,我发现观察ASM做了啥操作非常有意思。

sql> alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy'='high' NOTE: updated format of group 5 file 311 for 3-way mirroring NOTE: updated redundancy of group 5 file 311 to 3-way mirrored (remirror 0x4) NOTE: updated format of group 5 file 310 for 3-way mirroring NOTE: updated redundancy of group 5 file 310 to 3-way mirrored (remirror 0x4) NOTE: updated format of group 5 file 309 for 3-way mirroring NOTE: updated redundancy of group 5 file 309 to 3-way mirrored (remirror 0x4) NOTE: GroupBlock outside rolling migration privileged region NOTE: client +ASM1:+ASM:rac122pri no longer has group 5 (FLEX) mounted NOTE: client +ASM1:+ASM:rac122pri no longer has group 3 (DATA) mounted NOTE: client +ASM1:+ASM:rac122pri no longer has group 2 (MGMT) mounted NOTE: requesting all-instance membership refresh for group=5 NOTE: membership refresh pending for group 5/0x4718f00c (FLEX) GMON querying group 5 at 835 for pid 25,osid 11576 SUCCESS: refreshed membership for 5/0x4718f00c (FLEX) SUCCESS: alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy'='high'
2017-07-06 13:17:47.169000 +01:00
NOTE: Attempting voting file refresh on diskgroup FLEX
NOTE: Refresh completed on diskgroup FLEX. No voting file found.
NOTE: starting rebalance of group 5/0x4718f00c (FLEX) at power 1
NOTE: starting process ARBA
Starting background process ARBA
ARBA started with pid=33,OS id=9904
NOTE: starting process ARB0
Starting background process ARB0
ARB0 started with pid=48,OS id=9906
NOTE: assigning ARBA to group 5/0x4718f00c (FLEX) to compute estimates
NOTE: assigning ARB0 to group 5/0x4718f00c (FLEX) with 1 parallel I/O
2017-07-06 13:18:29.554000 +01:00
NOTE: Starting expel slave for group 5/0x4718f00c (FLEX)
NOTE: stopping process ARB0
NOTE: stopping process ARBA
NOTE: GroupBlock outside rolling migration privileged region
NOTE: requesting all-instance membership refresh for group=5
SUCCESS: rebalance completed for group 5/0x4718f00c (FLEX)
NOTE: membership refresh pending for group 5/0x4718f00c (FLEX)
GMON querying group 5 at 836 for pid 25,osid 11576
SUCCESS: refreshed membership for 5/0x4718f00c (FLEX)
2017-07-06 13:18:32.568000 +01:00
NOTE: Attempting voting file refresh on diskgroup FLEX
NOTE: Refresh completed on diskgroup FLEX. No voting file found.

re-mirror操作在警告日志中被列为(mini) rebalance操作。

新加的数据文件会怎样?

元数据的改变在v$asm_filegroup_properties视图中也可以看到。该PDB创建的每个新数据文件都是HIGH冗余度。

sql> select file_type,value from v$asm_filegroup_property
  2  where filegroup_number = 6 and file_type = 'DATAFILE';

FILE_TYPE       NAME                 VALUE
--------------- -------------------- --------------------
DATAFILE        REDUNDANCY           HIGH
DATAFILE        STRIPING             COARSE

加了个表空间,新的数据文件也依然是HIGH冗余度。

sql> select file_number,remirror
  2  from v$asm_file where filegroup_number = 6
  3  order by file_number;

FILE_NUMBER      BYTES      SPACE TYPE            REDUND R STRIPE R
----------- ---------- ---------- --------------- ------ - ------ -
        309  167780352  528482304 DATAFILE        HIGH   U COARSE N
        310  272637952  843055104 DATAFILE        HIGH   U COARSE N
        311  471867392 1434451968 DATAFILE        HIGH   U COARSE N
        312   67117056  142606336 TEMPFILE        MIRROR U COARSE N
        313 2147491840 6467616768 DATAFILE        HIGH   U COARSE N

总结

Flex ASM磁盘组继续让我惊叹。使用文件组,我可以单独为任意实体(non-CDB,CDB,PDB)定义属性,而且可以在磁盘组内部进行更细粒度的数据保护模式设置。在12c之前的版本,虽然我也可以完成同样的任务,但是操作要复杂很多很多。不得不承认,Flex磁盘组确实相当flexible。

原文链接:https://www.f2er.com/oracle/207718.html

猜你在找的Oracle相关文章