Oracle 11.2.0.3管理ASM实例

ASM实例目前无论是在rac还是单实例数据库环境下都被广泛的采用,本文主要介绍Oracle 11.2.0.3环境下ASM实例的管理,主要包含以下内容:
1:ASM磁盘及磁盘组的状态查看
2:创建external 冗余磁盘组,添加,删除磁盘
3:创建normal redundancy磁盘组
4:normal redundancy下的failgroup测试
5:删除ASM磁盘组
6:其他asm实例初始化参数含义

一:查看ASM磁盘及磁盘组状态
SQL> select * from v$asm_disk;
SQL> select * from v$asm_diskgroup;

二:创建external 冗余磁盘组,添加,删除磁盘,删除磁盘的时候需要指定磁盘的name而不是path

  1. SQL> create diskgroup FRA external redundancy disk '/dev/asm-disk4';
  2. Diskgroup created.
  3. SQL> alter diskgroup fra add disk '/dev/asm-disk5' rebalance power 10;
  4. Diskgroup altered.
  5. SQL> select name,failgroup,path from v$asm_disk;
  6. NAME FAILGROUP PATH
  7. -------------------- -------------------- --------------------
  8. DATA_0000 DATA_0000 /dev/asm-disk1
  9. DATA_0001 DATA_0001 /dev/asm-disk3
  10. DATA_0002 DATA_0002 /dev/asm-disk2
  11. FRA_0000 FRA_0000 /dev/asm-disk4
  12. FRA_0001 FRA_0001 /dev/asm-disk5
  13. /dev/asm-disk6
  14. /dev/asm-disk7
  15. SQL> alter diskgroup fra drop disk '/dev/asm-disk4' rebalance power 10;
  16. alter diskgroup fra drop disk '/dev/asm-disk4' rebalance power 10
  17. *
  18. ERROR at line 1:
  19. ORA-15032: not all alterations performed
  20. ORA-15054: disk "/DEV/ASM-DISK4" does not exist in diskgroup "FRA"
  21. SQL> alter diskgroup fra drop disk 'FRA_0000' rebalance power 10;
  22. Diskgroup altered.

三:创建normal redundancy磁盘组

  1. SQL> conn /as sysasm
  2. Connected.
  3. SQL> create diskgroup fra normal redundancy
  4. failgroup fg1 disk '/dev/asm-disk4','/dev/asm-disk5'
  5. failgroup fg2 disk '/dev/asm-disk6','/dev/asm-disk7'
  6. attribute 'compatible.rdbms'='11.2','compatible.asm'='11.2';
  7. Diskgroup created.
  8. SQL> select name, total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup;
  9. NAME TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
  10. ---------- ---------- ---------- ----------------------- --------------
  11. DATA 61440 54873 0 18291
  12. FRA 81920 81592 20480 30556

四:failgroup测试;FAILGROUP是用于将磁盘分组,以保证丢失任何一组FAILGROUP磁盘,数据还是完整的,多用于多阵列,通过ASM来完成冗余的环境!
1:查看FRA磁盘组中failgroup信息及磁盘状态

  1. SQL> select name,path,failgroup,mount_status from v$asm_disk where group_number=2;
  2. NAME PATH FAILGROUP MOUNT_STATUS
  3. -------------------- -------------------- ---------- ---------------------
  4. FRA_0003 /dev/asm-disk7 FG2 CACHED
  5. FRA_0002 /dev/asm-disk6 FG2 CACHED
  6. FRA_0000 /dev/asm-disk4 FG1 CACHED
  7. FRA_0001 /dev/asm-disk5 FG1 CACHED

2:在rdbms实例中创建表空间,建表并插入数据,收集表统计信息

  1. SQL> create tablespace test01 datafile '+FRA';
  2. Tablespace created.
  3. ASMCMD> pwd
  4. +fra/db/datafile
  5. ASMCMD> ls
  6. TEST01.256.800622493
  7. SQL> create table t1 tablespace test01 as select * from dba_objects;
  8. Table created.
  9. SQL> exec dbms_stats.gather_table_stats('SYS','T1');
  10. PL/SQL procedure successfully completed.
  11. SQL> select count(*) from t1;
  12. COUNT(*)
  13. ----------
  14. 74501

3:删除udev相关规则,重启数据库实例和ASM实例,验证数据是否存在

  1. SQL> conn /as sysasm
  2. Connected.
  3. SQL> alter diskgroup fra mount;
  4. alter diskgroup fra mount
  5. *
  6. ERROR at line 1:
  7. ORA-15032: not all alterations performed
  8. ORA-15040: diskgroup is incomplete
  9. ORA-15042: ASM disk "1" is missing from group number "2"
  10. ORA-15042: ASM disk "0" is missing from group number "2"
  11. SQL> alter diskgroup fra mount force;
  12. Diskgroup altered.
  13. SQL> select name,path,failgroup,mount_status from v$asm_disk;
  14. NAME PATH FAILGROUP MOUNT_STATUS
  15. ---------- -------------------- -------------------- ---------------------
  16. FRA_0000 FG1 MISSING
  17. FRA_0001 FG1 MISSING
  18. FRA_0002 /dev/asm-disk6 FG2 CACHED
  19. FRA_0003 /dev/asm-disk7 FG2 CACHED
  20. DATA_0000 /dev/asm-disk1 DATA_0000 CACHED
  21. DATA_0002 /dev/asm-disk2 DATA_0002 CACHED
  22. DATA_0001 /dev/asm-disk3 DATA_0001 CACHED
  23. 7 rows selected.
  24. SQL> conn /as sysdba
  25. Connected.
  26. SQL> select count(*) from t1;
  27. COUNT(*)
  28. ----------
  29. 74501

相关推荐