截止到Oracle 18c,Oracle ASM DiskGroup有5中类型,包括External、Normal、High、Flex、Extended(在12.2中,用于Extend RAC)。在asmcmd lsdg的输出中,对于FLEX DiskGroup的磁盘组,Req_mir_free_MB和Usable_file_MB的值不适用,值始终未0。
在oracle 18c中,还有一个新特性就是通过Oracle ASM Flex DiskGroup做基于时间点的PDB克隆,需要具体下面的条件
1.只支持FLEX和EXTENDED磁盘组类型创建Flex磁盘组的语句
2.数据库是18.1以上的版本
3.磁盘组属性 COMPATIBLE.ASM,COMPATIBLE.RDBMS必须是18.0及以上
4.目前只支持在同一容器下的PDB的clone,对非容器数据库暂时还不支持
CREATE DISKGROUP DATA FLEX REDUNDANCY DISK '/dev/oracleasm/disks/OHS3' SIZE 20480M
DISK '/dev/oracleasm/disks/OHS4' SIZE 20480M
QUORUM DISK '/dev/oracleasm/disks/OHS5' SIZE 20480M
ATTRIBUTE 'compatible.asm'='18.0.0.0','compatible.advm'='18.0.0.0','au_size'='4M';
我们还可以将Normal或High类型的磁盘组转化为Flex类型
SQL> CREATE DISKGROUP NORMALTOFLEX NORMAL REDUNDANCY DISK '/devices/diskm*' ATTRIBUTE 'au_size'='4M', 'compatible.asm' = '18.0', 'compatible.rdbms' = '18.0', 'compatible.advm' = '18.0'; Diskgroup created. SQL> ALTER DISKGROUP normaltoflex CONVERT REDUNDANCY TO FLEX; Diskgroup altered. SQL> SELECT name, type FROM V$ASM_DISKGROUP WHERE name = 'NORMALTOFLEX'; NAME TYPE ------------------------------ ------ NORMALTOFLEX FLEX
下面的试验是把pdb1克隆到pdb3,下面是截图
用grid用户执行下面的步骤 sqlplus / as sysasm alter diskgroup set attribute 'compitable.rdbms='18.0'; 用数据库用户执行下面的步骤 sqlplus / as sysdba alter session set container=pdb1; alter pluggable database pdb1 prepare mirror copy pdbcopy; conn / as sysdba create pluggable database pdb3 from pdb1 using mirror copy pdbcopy; alter pluggable database pdb3 open; 用grid用户执行下面的步骤 sqlplus / as sysasm alter diskgroup data add quotagroup ohsqg set quota = 200g; alter diskgroup data move filegroup pdbcopy to ohsqg; alter diskgroup data modify filegroup pnoncdb set 'redundancy' = 'unprotected';
修改ASM的compitable.rdbms版本为18.0
创建基于pdb1的mirror copy,copy的名字为pdbcopy(自定义的名字)
注意:在创建pdb3时,您可能会得到一个ORA-59003错误。这表明副本还没有准备好被分割。如果是的话,等几分钟再试一次。
下面是做prepare mirror copy pdbcopy时的ASM日志信息
创建quota group,来限制File Group(也就是数据库pdb3)的使用量,这一步是可选的
我们还可以修改File Group的冗余类型
通过chfg命令来修改,和通过命令行是一样的
alter diskgroup DATA modify filegroup PNONCDB set 'redundancy'='unprotected' ;
FileGroup的参考手册
Modifies a file group in a disk group based on an XML configuration file or script.
Modifies a quota group in the disk group.
List file groups in a disk group.
Lists the quota groups in a disk group.
Creates a file group in a disk group based on an XML configuration file or script.
Adds a quota group to the disk group.
Moves a file group in a disk group to the specified quota group.
Removes an existing file group from a disk group.
Drops a quota group from a disk group.
修改FileGroup冗余类型
Command
Description
修改File Group时对应的ASM alert日志
Reference
https://docs.oracle.com/en/database/oracle/oracle-database/18/ostmg/mirroring-diskgroup-redundancy.html
https://docs.oracle.com/en/database/oracle/oracle-database/18/ostmg/asm-filegroups.html
https://docs.oracle.com/en/database/oracle/oracle-database/18/ostmg/asmcmd-filegroup-commands.html