前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Oracle 12c ASM专题|Flex磁盘组到底有多Fexible?

Oracle 12c ASM专题|Flex磁盘组到底有多Fexible?

作者头像
沃趣科技
发布2018-03-26 14:20:35
9430
发布2018-03-26 14:20:35
举报
文章被收录于专栏:沃趣科技

原文链接 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的保护模式。这里最好给大家举个例子:

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

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

文件组属性

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

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

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

看到这个我很高兴。 使用sql依然可以达到这种效果,这里是等价的输出:

代码语言:javascript
复制
SQL> select file_type, name, 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$asm_file视图,你们也可以查v$asm_filegroup_file这个视图:

代码语言:javascript
复制
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的信息。在进行操作之前,我们先看下里面的内容:

代码语言:javascript
复制
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                 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号文件组的属性:

代码语言:javascript
复制
SQL> alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy'='high';
Diskgroup altered.

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

代码语言:javascript
复制
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号文件是临时文件。

代码语言:javascript
复制
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                 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,bytes,space,type,redundancy,redundancy_lowered,striped,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做了啥操作非常有意思。

代码语言:javascript
复制
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冗余度。

代码语言:javascript
复制
SQL> select file_type, name, 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冗余度。

代码语言:javascript
复制
SQL> select file_number,bytes,space,type,redundancy,redundancy_lowered,striped,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。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2017-09-08,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 沃趣科技 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
数据库
云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档