总结助手?
977
2022-05-28
10G:
从10G开始,出现GRID网格工具,ASM不支持存放OCR和Voting Disks,需要使用OCFS或者OCFS2。
Table 3-1 Supported Storage Options for Oracle Clusterware, Database, and Recovery Files
Automatic Storage Management
|
No
|
No
|
Yes
|
Yes
|
|
OCFS
|
Yes
|
No
|
Yes
|
Yes
|
|
OCFS2
|
Yes
|
Yes
|
Yes
|
Yes
|
|
GPFS (for Linux on POWER)
|
Yes
|
Yes
|
Yes
|
Yes
|
|
Local storage
|
No
|
Yes
|
No
|
No
|
|
NFS file system
Note: Requires a certified NAS device
|
Yes
|
Yes
|
Yes
|
Yes
|
|
Shared raw partitions
|
Yes
|
No
|
Yes
|
No
|
|
Block devices (IBM zSeries based systems only)
|
Yes
|
Yes
|
Yes
|
No
|
ASM冗余方式:
冗余方式有3种:External、Normal、High。
仅支持数据文件和恢复文件存放,需要磁盘数量对应冗余为1、2、3。
Use the following table to determine the minimum number of disks and the minimum disk space requirements for installing the starter database:
11G:
从11G开始,ASM支持OCR和Voting Disk Files存放,OCFS淘汰,开始大量使用ASM。
Table 3-2 Supported Storage Options for Oracle Clusterware and Oracle RAC
Oracle Automatic Storage Management (Oracle ASM)
Note: Loopback devices are not supported for use with Oracle ASM
|
Yes
|
No
|
No
|
Yes
|
Yes
|
|
Oracle Automatic Storage Management Cluster File System (Oracle ACFS)
|
No
|
No
|
Yes
|
No
|
No
|
|
Local file system
|
No
|
Yes
|
Yes
|
No
|
No
|
|
NFS file system on a certified NAS filer
Note: Direct NFS Client does not support Oracle Clusterware files.
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
|
Shared disk partitions (block devices or raw devices)
|
Not supported by OUI or ASMCA, but supported by the software. They can be added or removed after installation.
|
No
|
No
|
Not supported by OUI or ASMCA, but supported by the software. They can be added or removed after installation.
|
No
|
ASM冗余方式:
冗余方式有3种:External、Normal、High。
OCR和Voting Disk需要磁盘数量对应冗余:1、3、5。
Table 3-5 Total Oracle Clusterware Storage Space Required by Redundancy Type
External
|
1
|
300 MB
|
300 MB
|
600 MB
|
|
Normal
|
3
|
600 MB
|
900 MB
|
1.5 GBFoot 1
|
|
High
|
5
|
900 MB
|
1.5 GB
|
2.4 GB
|
数据文件和恢复文件存放,需要磁盘数量对应冗余为1、2、3。
Table 3-6 Total Oracle Database Storage Space Required by Redundancy Type
External
|
1
|
1.5 GB
|
3 GB
|
4.5 GB
|
|
Normal
|
2
|
3 GB
|
6 GB
|
9 GB
|
|
High
|
3
|
4.5 GB
|
9 GB
|
13.5 GB
|
19C:
从19C开始,重新支持OCFS2(仅支持存放数据文件和恢复文件)。
19C开始支持CDB和PDB。
Table 7-1 Supported Storage Options for Oracle Grid Infrastructure
Oracle Automatic Storage Management (Oracle ASM)
Note: Loopback devices are not supported for use with Oracle ASM
|
Yes
|
No
|
No
|
Yes
|
Yes
|
| Oracle Automatic Storage Management Cluster File System (Oracle ACFS) |
No
|
No
|
Yes for Oracle Database 11g Release 2 (11.2) and for Hub Nodes for Oracle Database 12c Release 1 (12.1) and later.
No for running Oracle Database on Leaf Nodes.
|
Yes for Oracle Database 12c Release 1 (12.1) and later
|
Yes for Oracle Database 12c Release 1 (12.1) and later
|
| Local file system |
No
|
Yes
|
Yes
|
No
|
No
|
|
OCFS2
|
No
|
No
|
Yes
|
Yes
|
Yes
|
|
Network file system (NFS) on a certified network-attached storage (NAS) filer
Note: Direct NFS Client does not support Oracle Clusterware files
|
No
|
Yes
|
Yes
|
Yes
|
Yes
|
| Direct-attached storage (DAS) |
No
|
No
|
Yes
|
Yes
|
Yes
|
|
Shared disk partitions (block devices or raw devices)
|
No
|
No
|
No
|
No
|
No
|
ASM冗余方式:
在11G基础上,增加冗余方式:弹性冗余(Flex),支持修改数据库文件冗余。
冗余方式有3种:External、Normal、High、Flex。
OCR和Voting Disk需要磁盘数量对应冗余:1、3、5、3。
数据文件和恢复文件存放,需要磁盘数量对应冗余为1、2、3、3。
Table 8-1 Oracle ASM Disk Space Minimum Requirements for Oracle Database
Table 8-2 Oracle ASM Disk Space Minimum Requirements for Oracle Database (non-CDB)
注意点:
1、单个磁盘的大小不要大于2T(2000G),因为超过2T的磁盘无法创建磁盘组。
2、尽量使用多块大小相同的磁盘创建同一磁盘组,这样做的好处有两点:
a.磁盘头部损坏时方便更换,减少数据损坏风险。
b.如果大小不统一,容易导致磁盘组剩余容量足够但不能使用的问题。
3、为ASM磁盘组增加磁盘时,会导致rebalance,占用IO资源,尽量在非生产时间添加磁盘。
外部冗余磁盘组(external disgroup)操作
1.创建磁盘组
例1
sqlplus / as sysasm create diskgroup dgroup_01 external redundancy disk '/devices/disks/c*';
例2
sqlplus / as sysasm create diskgroup DATADG external redundancy disk '/dev/asm-diskb' ATTRIBUTE 'compatible.rdbms'='11.2','compatible.asm'='11.2';
2.给磁盘组加盘
su - grid
sqlplus / as sysasm
alter diskgroup 磁盘组的名字 add disk ‘/dev/rhdisk5’ rebalance power 5;
或者 alter diskgroup 磁盘组的名字 add disk ‘/dev/rhdisk5’ named DISK5,add disk ‘/dev/rhdisk6’ named DISK6;
3.给磁盘组删盘
su - grid
sqlplus / as sysasm
alter diskgroup drop disk data_01;
4.撤销删除动作
su - grid
sqlplus / as sysasm
alter diskgroup data undrop disk;
5.修改asm磁盘大小
*asm中的磁盘也可以resize,需要注意:增大磁盘大小要确定对应的裸卷具有足够空间,减少空间要确保剩余的空间足以存放数据量大小,否则会报错
例:
alter diskgroup data resize disk data_01 size 1024m;
6.rebalance
ALTER DISKGROUP fra REBALANCE POWER 4
alter diskgroup data drop disk DATA_0000 rebalance power 3;
power代表并行度,值越大rebalance越快,但占用资源越多
power:0~11 , 0代表不做 rebalance
11.2.0.2 版本上限为 1024
查看rebalance进度
select operation,state,power,actual,sofar,est_work,est_minutes from v$asm_operation;
快速rebalance方法
sqlplus / as sysasm
startup restrict;
alter diskgroup dgext11gasm mount restricted;
alter diskgroup dgext11gasm rebalance power 10;
shutdown immediate;
startup
7.mount/dismount
alter diskgroup data mount/unmount
*以上操作只在当前实例挂载磁盘组,如果想每个实例都挂载,需要分别在各个实例中执行!
alter diskgroup all mount/dismount
挂载/卸载所有的磁盘组。
8.删磁盘组(drop diskgroup)
drop diskgroup data
*需要磁盘组mount状态,对于多节点的diskgroup,只能在一个asm实例上挂载之后才能被drop,其他节点必须dismount。
另:drop diskgroup data including contents;
9.disk online
alter diskgroup DATA online disk ‘diskname’;
或者:alter diskgroup DATA online all;
10.磁盘组的属性调整
alter diskgroup data set attribute ‘DISK_REPAIR_TIME’=‘12h’;
11.文件别名操作
加别名
ALTER DISKGROUP disk_group_1 ADD ALIAS ‘+disk_group_1/my_dir/my_file.dbf’ FOR ‘+disk_group_1/mydb/datafile/my_ts.342.3’;
改别名
ALTER DISKGROUP disk_group_1 RENAME ALIAS ‘+disk_group_1/my_dir/my_file.dbf’ TO ‘+disk_group_1/my_dir/my_file2.dbf’;
删别名
ALTER DISKGROUP disk_group_1 DELETE ALIAS ‘+disk_group_1/my_dir/my_file.dbf’;
删文件
ALTER DISKGROUP disk_group_1 DROP FILE ‘+disk_group_1/my_dir/my_file.dbf’;
六、使用NORMAL冗余磁盘组的操作
EXTERNAL means allow the underlying physical disk array do the mirroring
NORMAL means ASM will create one additional copy of an extent for redundancy
HIGH means ASM will create two additional copies of an extent for redundancy
由于使用extent进行冗余,这种特性允许各 failure group总容量可以不一致
要改变冗余度,需要新建磁盘组
USABALE_FILE_MB = (FREE_MB - REQUIRED_MIRROR_FREE_MB) / 2
1.查看failure group
select name,total_mb,free_mb,GROUP_NUMBER,DISK_NUMBER,path,FAILGROUP,MOUNT_STATUS,HEADER_STATUS
from v$asm_disk order by FAILGROUP
2.创建磁盘组
sqlplus / as asmsys
CREATE DISKGROUP data1 NORMAL REDUNDANCY
FAILGROUP data1f1 DISK
‘/dev/fg11’ name f1d1,
‘/dev/fg12’ name f1d2
FAILGROUP data1f2 DISK
‘/dev/fg21’ name f2d1,
‘/dev/fg22’ name f2d2
ATTRIBUTE ‘compatible.asm’ = ‘11.2’;
CREATE DISKGROUP data2 NORMAL REDUNDANCY
FAILGROUP data2f1 DISK
‘/dev/fg13’ name f3d1,
‘/dev/fg14’ name f3d2
FAILGROUP data2f2 DISK
‘/dev/fg23’ name f4d1,
‘/dev/fg24’ name f4d2
ATTRIBUTE ‘compatible.asm’ = ‘11.2’;
3.给磁盘组加盘
alter diskgroup DATA1 add failgourp data1f2 disk ‘/dev/fg21’ name data1f2;
*如果磁盘有盘头信息时加入会报错
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15033: disk ‘/dev/fg21’ belongs to diskgroup “DATA1”
此时可以用force选项加盘,但注意会清掉磁盘头
alter diskgroup data1 add failgroup data1f2 disk ‘/dev/fg21’ name data1f2 force;
4.disk online
alter diskgroup data1 online disk f2d1;
5.EXTENT RAC提升读取速度
在对有 failure group的读取时,默认是先读 primary copy ,由于 primary copy是交替写的,对于存储距离很远不合适, 11.1 之后提供参数调整为
alter system set ASM_PREFERRED_READ_FAILURE_GROUPS=‘DATA.FG01’ sid=‘ORCL1’;
alter system set ASM_PREFERRED_READ_FAILURE_GROUPS=‘DATA.FG01’ sid=‘ORCL2’;
alter system set ASM_PREFERRED_READ_FAILURE_GROUPS=‘DATA.FG02’ sid=‘ORCL3’;
则每个实例优先读本地存储,适合 extend rac情况
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。