沃趣科技的ITPUB博客

让数据驱动未来!

  • 博客访问: 410790
  • 博文数量: 71
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-18 13:18
  • 认证徽章:
ITPUB论坛APP

ITPUB论坛APP



APP发帖 享双倍积分

文章分类

全部博文(71)

文章存档

2017年(43)

2016年(28)

微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

订阅
热词专题

分类: Oracle

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

点击(此处)折叠或打开

  1. SQL> select filegroup_number,name,guid from v$asm_filegroup

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

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

点击(此处)折叠或打开

  1. SQL> select file_number,bytes,space,type,redundancy,redundancy_lowered,striped,remirror
  2.   2 from v$asm_file where filegroup_number = 6;
  3.   
  4. FILE_NUMBER BYTES SPACE TYPE REDUNDANCY REDUNDANCY_LOWERED STRIPED REMIRROR
  5. 309 104865792 218103808 DATAFILE MIRROR U COARSE N
  6. 310 262152192 541065216 DATAFILE MIRROR U COARSE N
  7. 311 419438592 859832320 DATAFILE MIRROR U COARSE N
  8. 312 67117056 142606336 TEMPFILE MIRROR U COARSE N
 官方文档说的没错,存放在Flex磁盘组上的数据文件默认冗余度是2副本。

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

点击(此处)折叠或打开

  1. ASMCMD> lsfg -G flex --filegroup PDB1_0001
  2. File Group Disk Group Property Value File Type
  3. PDB1_0001 FLEX PRIORITY MEDIUM
  4. PDB1_0001 FLEX STRIPING COARSE CONTAINER
  5. PDB1_0001 FLEX STRIPING FINE CONTROLFILE
  6. PDB1_0001 FLEX REDUNDANCY MIRROR DATAFILE
  7. PDB1_0001 FLEX STRIPING COARSE DATAFILE
  8. PDB1_0001 FLEX REDUNDANCY MIRROR ONLINELOG
  9. PDB1_0001 FLEX STRIPING COARSE ONLINELOG
  10. PDB1_0001 FLEX REDUNDANCY MIRROR ARCHIVELOG
  11. PDB1_0001 FLEX STRIPING COARSE ARCHIVELOG
  12. PDB1_0001 FLEX REDUNDANCY MIRROR TEMPFILE
  13. PDB1_0001 FLEX STRIPING COARSE TEMPFILE
  14. PDB1_0001 FLEX REDUNDANCY MIRROR BACKUPSET
  15. PDB1_0001 FLEX STRIPING COARSE BACKUPSET
  16. PDB1_0001 FLEX REDUNDANCY MIRROR PARAMETERFILE
  17. PDB1_0001 FLEX STRIPING COARSE PARAMETERFILE
  18. PDB1_0001 FLEX REDUNDANCY MIRROR DATAGUARDCONFIG
  19. PDB1_0001 FLEX STRIPING COARSE DATAGUARDCONFIG
  20. PDB1_0001 FLEX REDUNDANCY MIRROR CHANGETRACKING
  21. PDB1_0001 FLEX STRIPING COARSE CHANGETRACKING
  22. PDB1_0001 FLEX REDUNDANCY MIRROR FLASHBACK
  23. PDB1_0001 FLEX STRIPING COARSE FLASHBACK
  24. PDB1_0001 FLEX REDUNDANCY MIRROR DUMPSET
  25. PDB1_0001 FLEX STRIPING COARSE DUMPSET
  26. PDB1_0001 FLEX REDUNDANCY MIRROR AUTOBACKUP
  27. PDB1_0001 FLEX STRIPING COARSE AUTOBACKUP
  28. PDB1_0001 FLEX REDUNDANCY MIRROR VOTINGFILE
  29. PDB1_0001 FLEX STRIPING COARSE VOTINGFILE
  30. PDB1_0001 FLEX REDUNDANCY MIRROR OCRFILE
  31. PDB1_0001 FLEX STRIPING COARSE OCRFILE
  32. PDB1_0001 FLEX REDUNDANCY MIRROR ASMVOL
  33. PDB1_0001 FLEX STRIPING COARSE ASMVOL
  34. PDB1_0001 FLEX REDUNDANCY MIRROR ASMVDRL
  35. PDB1_0001 FLEX STRIPING COARSE ASMVDRL
  36. PDB1_0001 FLEX REDUNDANCY MIRROR OCRBACKUP
  37. PDB1_0001 FLEX STRIPING COARSE OCRBACKUP
  38. PDB1_0001 FLEX REDUNDANCY MIRROR FLASHFILE
  39. PDB1_0001 FLEX STRIPING COARSE FLASHFILE
  40. PDB1_0001 FLEX REDUNDANCY MIRROR XTRANSPORT BACKUPSET
  41. PDB1_0001 FLEX STRIPING COARSE XTRANSPORT BACKUPSET
  42. PDB1_0001 FLEX REDUNDANCY MIRROR AUDIT_SPILLFILES
  43. PDB1_0001 FLEX STRIPING COARSE AUDIT_SPILLFILES
  44. PDB1_0001 FLEX REDUNDANCY MIRROR INCR XTRANSPORT BACKUPSET
  45. PDB1_0001 FLEX STRIPING COARSE INCR XTRANSPORT BACKUPSET
  46. PDB1_0001 FLEX REDUNDANCY MIRROR KEY_STORE
  47. PDB1_0001 FLEX STRIPING COARSE KEY_STORE
  48. PDB1_0001 FLEX REDUNDANCY MIRROR AUTOLOGIN_KEY_STORE
  49. PDB1_0001 FLEX STRIPING COARSE AUTOLOGIN_KEY_STORE
  50. PDB1_0001 FLEX REDUNDANCY MIRROR CONTAINER
  51. PDB1_0001 FLEX REDUNDANCY HIGH CONTROLFILE
  52. ASMCMD>
 输出包含两大类属性:冗余和条带化。我真正关心的只有冗余度,而且我也没接触过条带化相关的属性。查了下官方文档 ASM Administrator’s guide(https://docs.oracle.com/database/122/OSTMG/asm-filegroups.htm#GUID-BE9083C8-A5DF-48CD-BB32-C8A6FCDA3E7B),
对条带化属性的解释如下:
> 这是文件类型的属性,仅需为每个文件类型设置。一般使用默认值就够了,不需要人为改变。

看到这个我很高兴。

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

点击(此处)折叠或打开

  1. SQL> select file_type, name, value from v$asm_filegroup_property where filegroup_number = 6;

  2. FILE_TYPE NAME VALUE
  3. ------------------------------ ------------------------------ ------------------------------
  4.                                PRIORITY MEDIUM
  5. CONTROLFILE REDUNDANCY HIGH
  6. CONTROLFILE STRIPING FINE
  7. DATAFILE REDUNDANCY MIRROR
  8. DATAFILE STRIPING COARSE
  9. ONLINELOG REDUNDANCY MIRROR
  10. ONLINELOG STRIPING COARSE
  11. ARCHIVELOG REDUNDANCY MIRROR
  12. ARCHIVELOG STRIPING COARSE
  13. TEMPFILE REDUNDANCY MIRROR
  14. TEMPFILE STRIPING COARSE
  15. BACKUPSET REDUNDANCY MIRROR
  16. BACKUPSET STRIPING COARSE
  17. PARAMETERFILE REDUNDANCY MIRROR
  18. PARAMETERFILE STRIPING COARSE
  19. DATAGUARDCONFIG REDUNDANCY MIRROR
  20. DATAGUARDCONFIG STRIPING COARSE
  21. CHANGETRACKING REDUNDANCY MIRROR
  22. CHANGETRACKING STRIPING COARSE
  23. FLASHBACK REDUNDANCY MIRROR
  24. FLASHBACK STRIPING COARSE
  25. DUMPSET REDUNDANCY MIRROR
  26. DUMPSET STRIPING COARSE
  27. AUTOBACKUP REDUNDANCY MIRROR
  28. AUTOBACKUP STRIPING COARSE
  29. VOTINGFILE REDUNDANCY MIRROR
  30. VOTINGFILE STRIPING COARSE
  31. OCRFILE REDUNDANCY MIRROR
  32. OCRFILE STRIPING COARSE
  33. ASMVOL REDUNDANCY MIRROR
  34. ASMVOL STRIPING COARSE
  35. ASMVDRL REDUNDANCY MIRROR
  36. ASMVDRL STRIPING COARSE
  37. OCRBACKUP REDUNDANCY MIRROR
  38. OCRBACKUP STRIPING COARSE
  39. FLASHFILE REDUNDANCY MIRROR
  40. FLASHFILE STRIPING COARSE
  41. XTRANSPORT BACKUPSET REDUNDANCY MIRROR
  42. XTRANSPORT BACKUPSET STRIPING COARSE
  43. AUDIT_SPILLFILES REDUNDANCY MIRROR
  44. AUDIT_SPILLFILES STRIPING COARSE
  45. INCR XTRANSPORT BACKUPSET REDUNDANCY MIRROR
  46. INCR XTRANSPORT BACKUPSET STRIPING COARSE
  47. KEY_STORE REDUNDANCY MIRROR
  48. KEY_STORE STRIPING COARSE
  49. AUTOLOGIN_KEY_STORE REDUNDANCY MIRROR
  50. AUTOLOGIN_KEY_STORE STRIPING COARSE
  51. CONTAINER REDUNDANCY MIRROR
  52. CONTAINER STRIPING COARSE

  53. 49 rows selected.
 除了v$asm_file视图,你们也可以查v$asm_filegroup_file这个视图:

点击(此处)折叠或打开

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

  5. FILEGROUP_NUMBER FILE_NUMBER INCARNATION
  6. ---------------- ----------- -----------
  7.                6 309 948464269
  8.                6 310 948464269
  9.                6 311 948464269
  10.                6 312 948464283

  11. SQL>
 FILE_NUMBER字段和INCARNATION可以被关联上v$asm_file。

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

点击(此处)折叠或打开

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

  3. FILE_NUMBER BYTES SPACE TYPE REDUND R STRIPE R
  4. ----------- ---------- ---------- -------------------- ------ - ------ -
  5.         309 104865792 218103808 DATAFILE MIRROR U COARSE N
  6.         310 262152192 541065216 DATAFILE MIRROR U COARSE N
  7.         311 419438592 859832320 DATAFILE MIRROR U COARSE N
  8.         312 67117056 142606336 TEMPFILE MIRROR U COARSE N

  9. 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号文件组的属性:

点击(此处)折叠或打开

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

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

点击(此处)折叠或打开

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

  2. Error starting at line : 1 in command -
  3. alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy' = 'high'
  4. Error report -
  5. ORA-15000: command disallowed by current instance type
  6. 15000. 00000 - "command disallowed by current instance type"
  7. *Cause: The user has issued a command to a conventional RDBMS instance
  8.            that is only appropriate for an ASM instance. Alternatively, the
  9.            user has issued a command to an ASM instance that is only
  10.            appropriate for an RDBMS instance.
  11. *Action: Connect to the correct instance type and re-issue the command.
  12. SQL>
 命令结束后,数据文件立刻开始了re-mirror操作。在re-mirror的过程中(即remirror字段为Y),冗余度依然为MIRROR。只有当re-mirror操作完成后(即remirror字段为N),冗余度才变为high。注意:312号文件的冗余度依然为normal,想想也对,我们修改的是datafile.redundancy,而312号文件是临时文件。

点击(此处)折叠或打开

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

  3. FILE_NUMBER BYTES SPACE TYPE REDUND R STRIPE R
  4. ----------- ---------- ---------- -------------------- ------ - ------ -
  5.         309 104865792 339738624 DATAFILE MIRROR U COARSE Y
  6.         310 262152192 805306368 DATAFILE MIRROR U COARSE Y
  7.         311 419438592 1283457024 DATAFILE MIRROR U COARSE Y
  8.         312 67117056 142606336 TEMPFILE MIRROR U COARSE N

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

  11. FILE_NUMBER BYTES SPACE TYPE REDUND R STRIPE R
  12. ----------- ---------- ---------- -------------------- ------ - ------ -
  13.         309 104865792 339738624 DATAFILE HIGH U COARSE N
  14.         310 262152192 805306368 DATAFILE HIGH U COARSE N
  15.         311 419438592 1283457024 DATAFILE HIGH U COARSE N
  16.         312 67117056 142606336 TEMPFILE MIRROR U COARSE N
 为了让实验结果更详细,我下面还列了ASM实例警告日志中的相关信息,我发现观察ASM做了啥操作非常有意思。

点击(此处)折叠或打开

  1. SQL> alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy'='high'
  2. NOTE: updated format of group 5 file 311 for 3-way mirroring
  3. NOTE: updated redundancy of group 5 file 311 to 3-way mirrored (remirror 0x4)
  4. NOTE: updated format of group 5 file 310 for 3-way mirroring
  5. NOTE: updated redundancy of group 5 file 310 to 3-way mirrored (remirror 0x4)
  6. NOTE: updated format of group 5 file 309 for 3-way mirroring
  7. NOTE: updated redundancy of group 5 file 309 to 3-way mirrored (remirror 0x4)
  8. NOTE: GroupBlock outside rolling migration privileged region
  9. NOTE: client +ASM1:+ASM:rac122pri no longer has group 5 (FLEX) mounted
  10. NOTE: client +ASM1:+ASM:rac122pri no longer has group 3 (DATA) mounted
  11. NOTE: client +ASM1:+ASM:rac122pri no longer has group 2 (MGMT) mounted
  12. NOTE: requesting all-instance membership refresh for group=5
  13. NOTE: membership refresh pending for group 5/0x4718f00c (FLEX)
  14. GMON querying group 5 at 835 for pid 25, osid 11576
  15. SUCCESS: refreshed membership for 5/0x4718f00c (FLEX)
  16. SUCCESS: alter diskgroup flex modify filegroup PDB1_0001 set 'datafile.redundancy'='high'
  17. 2017-07-06 13:17:47.169000 +01:00
  18. NOTE: Attempting voting file refresh on diskgroup FLEX
  19. NOTE: Refresh completed on diskgroup FLEX. No voting file found.
  20. NOTE: starting rebalance of group 5/0x4718f00c (FLEX) at power 1
  21. NOTE: starting process ARBA
  22. Starting background process ARBA
  23. ARBA started with pid=33, OS id=9904
  24. NOTE: starting process ARB0
  25. Starting background process ARB0
  26. ARB0 started with pid=48, OS id=9906
  27. NOTE: assigning ARBA to group 5/0x4718f00c (FLEX) to compute estimates
  28. NOTE: assigning ARB0 to group 5/0x4718f00c (FLEX) with 1 parallel I/O
  29. 2017-07-06 13:18:29.554000 +01:00
  30. NOTE: Starting expel slave for group 5/0x4718f00c (FLEX)
  31. NOTE: stopping process ARB0
  32. NOTE: stopping process ARBA
  33. NOTE: GroupBlock outside rolling migration privileged region
  34. NOTE: requesting all-instance membership refresh for group=5
  35. SUCCESS: rebalance completed for group 5/0x4718f00c (FLEX)
  36. NOTE: membership refresh pending for group 5/0x4718f00c (FLEX)
  37. GMON querying group 5 at 836 for pid 25, osid 11576
  38. SUCCESS: refreshed membership for 5/0x4718f00c (FLEX)
  39. 2017-07-06 13:18:32.568000 +01:00
  40. NOTE: Attempting voting file refresh on diskgroup FLEX
  41. NOTE: Refresh completed on diskgroup FLEX. No voting file found.
 re-mirror操作在警告日志中被列为(mini) rebalance操作。

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

点击(此处)折叠或打开

  1. SQL> select file_type, name, value from v$asm_filegroup_property
  2.   2 where filegroup_number = 6 and file_type = 'DATAFILE';

  3. FILE_TYPE NAME VALUE
  4. --------------- -------------------- --------------------
  5. DATAFILE REDUNDANCY HIGH
  6. DATAFILE STRIPING COARSE
 加了个表空间,新的数据文件也依然是HIGH冗余度。

点击(此处)折叠或打开

  1. SQL> select file_number,bytes,space,type,redundancy,redundancy_lowered,striped,remirror
  2.   2 from v$asm_file where filegroup_number = 6
  3.   3 order by file_number;

  4. FILE_NUMBER BYTES SPACE TYPE REDUND R STRIPE R
  5. ----------- ---------- ---------- --------------- ------ - ------ -
  6.         309 167780352 528482304 DATAFILE HIGH U COARSE N
  7.         310 272637952 843055104 DATAFILE HIGH U COARSE N
  8.         311 471867392 1434451968 DATAFILE HIGH U COARSE N
  9.         312 67117056 142606336 TEMPFILE MIRROR U COARSE N
  10.         313 2147491840 6467616768 DATAFILE HIGH U COARSE N
## 总结
Flex ASM磁盘组继续让我惊叹。使用文件组,我可以单独为任意实体(non-CDB, CDB, PDB)定义属性,而且可以在磁盘组内部进行更细粒度的数据保护模式设置。在12c之前的版本,虽然我也可以完成同样的任务,但是操作要复杂很多很多。不得不承认,Flex磁盘组确实相当flexible。

阅读(66) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册