1、 添加一个磁盘组
SQL> create diskgroup recover external redundancy disk 'ORCL:kel3'; Diskgroup created.
2、 删除一个磁盘组
SQL> drop diskgroup recover including contents;--删除磁盘组并且删除磁盘组中的内容 Diskgroup dropped.
3、在磁盘组中增加一个磁盘
SQL> alter diskgroup KEL add disk 'ORCL:KEL3' rebalance power 11;--参数rebalance power可以移动数据,可能会影响性能和移动的速度 Diskgroup altered.
4、在磁盘中删除一个磁盘
SQL> alter diskgroup KEL drop disk KEL3; Diskgroup altered.
5、卸载磁盘组
SQL> alter diskgroup KEL dismount;--指定磁盘组进行卸载 Diskgroup altered. SQL> alter diskgroup all dismount;--对所有的磁盘组进行卸载 Diskgroup altered.
6、挂载磁盘组
SQL> alter diskgroup KEL mount;--指定磁盘组进行挂载 Diskgroup altered. SQL> alter diskgroup all mount;--将所有的磁盘组进行挂载,如果已经有磁盘组挂载了,那么会报错 Diskgroup altered.
7、查看磁盘组rebalance参数
SQL> show parameter asm_power_limit NAME TYPE VALUE
------------------------------------ ---------- ------------------------------
asm_power_limit integer 1
8、修改磁盘组rebalance参数
SQL> alter diskgroup KEL rebalance power 11;--参数指定的范围为0-11,11为速度最快,也是最影响性能 Diskgroup altered.
9.、 磁盘组信息的查看
SQL> select name,state,type,total_mb,free_mb from v$asm_diskgroup; NAME STATE TYPE TOTAL_MB FREE_MB
---------- ---------------------- ---------- ---------- ----------
ASM MOUNTED NORMAL 4094 242
KEL MOUNTED EXTERN 4094 2646
10、 磁盘信息查看
SQL> select group_number,path,state,total_mb,free_mb from v$asm_disk; GROUP_NUMBER PATH STATE TOTAL_MB FREE_MB
------------ ---------- ---------------- ---------- ----------
0 ORCL:KEL3 NORMAL 2047 0
3 ORCL:KEL1 NORMAL 2047 1323
3 ORCL:KEL2 NORMAL 2047 1323
2 ORCL:DATA NORMAL 2047 121
2 ORCL:OCR_V NORMAL 2047 121
OTE
11、磁盘组的冗余方式
普通冗余:每个磁盘组有两个failgroup
高冗余:每个磁盘组有三个failgroup
外部冗余:通过存储设备来形成failgroup
目的:保证数据的安全性
SQL> create diskgroup recover normal redundancy failgroup fg1 disk 'ORCL:KEL2' failgroup fg2 disk 'ORCL:KEL3'; Diskgroup created.
12、磁盘目录的管理
SQL> alter diskgroup RECOVER add directory '+recover/ipap';--磁盘组中添加目录 Diskgroup altered. SQL> alter diskgroup RECOVER rename directory '+recover/ipap' to '+recover/kel';--磁盘组中修改目录名称 Diskgroup altered. SQL> alter diskgroup RECOVER drop directory '+recover/kel' force;--磁盘组中删除目录 Diskgroup altered. SQL> alter diskgroup asm drop file '+asm/ipap/onlinelog/group_4.257.850695777';--删除磁盘组中的文件 Diskgroup altered.
13、ASM磁盘组与数据库
初始化参数DB_CREATE_FILE_DEST指定数据文件路径
控制文件路径:CONTROL_FILES>DB_CREATE_ONLINE_LOG_DEST_n>DB_CREATE_FILE_DEST
redo日志文件路径:DB_CREATE_ONLINE_LOG_DEST_n
14、 相关的表
select * from v$asm_diskgroup
select * from v$asm_operation
select * from v$asm_disk_stat
select * from v$asm_diskgroup_stat
select * from v$asm_template
select * from v$asm_file
select * from v$asm_client
15、asm的基本进程
[oracle@kel ~]$ ps -fe|grep asm
oracle 5601 1 0 19:36 ? 00:00:00 asm_pmon_+ASM
oracle 5604 1 0 19:36 ? 00:00:00 asm_psp0_+ASM
oracle 5606 1 0 19:36 ? 00:00:00 asm_mman_+ASM
oracle 5608 1 0 19:36 ? 00:00:01 asm_dbw0_+ASM
oracle 5610 1 0 19:36 ? 00:00:01 asm_lgwr_+ASM
oracle 5612 1 0 19:36 ? 00:00:00 asm_ckpt_+ASM
oracle 5614 1 0 19:36 ? 00:00:00 asm_smon_+ASM
oracle 5616 1 0 19:36 ? 00:00:01 asm_rbal_+ASM
oracle 5618 1 0 19:36 ? 00:00:04 asm_gmon_+ASM