OCA读书笔记(5) - 管理ASM实例

时间:2022-10-25 18:02:39

Objectives:
Describe the benefits of using ASM
Manage the ASM instance
Create and drop ASM disk groups
Extend ASM disk groups
Retrieve ASM metadata by using various utilities
Using SQL*Plus
SELECT * FROM v$asm_alias, v$asm_file
Using asmcmd
ASMCMD> ls -l +DATA/orcl/datafile

----------------------------------------------------------------------------------------------------------

su - grid

sqlplus / as sysdba;
select group_number, name, state, type, total_mb, free_mb from v$asm_diskgroup;
高级冗余:至少三块磁盘,每份数据两份冗余
正常冗余:至少两块磁盘,每份数据一份冗余
外部冗余:至少一块盘,依靠外部冗余机制

select g.group_number, g.name Group_Name, d.disk_number, d.name Disk_Name, d.path, g.type
from v$asm_disk d, v$asm_diskgroup g
where d.group_number = g.group_number

conn / as sysdba;
shutdown abort;

conn / as sysasm;
shutdown abort;(权限足够,可以关闭)
startup mount;

su - grid
asmca
data_b

su - oracle
dbca
db01

export ORACLE_SID=db01
sqlplus / as sysdba;

演示:
将asm磁盘组中的一块磁盘低级格式化,然后将另一块磁盘加入该磁盘组,观察asm自动管理。

关闭系统,增加一块硬盘。
fdisk /dev/sde

vi /etc/udev/rules/rules.d/60
start_udev

su - grid
crs_stat -t

su - oracle
export ORACLE_SID=db01
sqlplus / as sysdba;

低级格式化磁盘
dd if=/dev/zero of=/dev/raw/raw2
dd if=/dev/zero of=/dev/raw/raw2 bs=1G count=5

su - grid
sqlplus / as sysasm;
shutdown abort;

alter diskgroup data_b mount force;
alter diskgroup data_b add disk '/dev/raw/raw4'

startup;