设为首页收藏本站

Botang唐波's Oracle Station

查看: 104|回复: 0

课程第8次(2018-05-31星期四)

[复制链接]

659

主题

1018

帖子

7486

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
7486
发表于 2018-5-31 20:01:15 | 显示全部楼层 |阅读模式
Linux上看盘:

  1. [root@station87 ~]# rpm -qa | grep oracleasm
  2. oracleasm-2.6.18-238.el5PAE-2.0.5-1.el5
  3. oracleasm-2.6.18-238.el5debug-2.0.5-1.el5
  4. oracleasm-2.6.18-238.el5xen-2.0.5-1.el5
  5. oracleasm-2.6.18-238.el5-2.0.5-1.el5
  6. oracleasm-support-2.1.8-1.el5
  7. oracleasmlib-2.0.4-1.el5
  8. [root@station87 ~]# oracleasm-discover
  9. Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
  10. [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
  11. Discovered disk: ORCL:DISK1 [12289725 blocks (6292339200 bytes), maxio 128]
  12. Discovered disk: ORCL:DISK2 [5638752 blocks (2887041024 bytes), maxio 128]
  13. Discovered disk: ORCL:DISK3 [5638752 blocks (2887041024 bytes), maxio 128]
  14. Discovered disk: ORCL:DISK4 [5638752 blocks (2887041024 bytes), maxio 128]
  15. Discovered disk: ORCL:DISK5 [5638752 blocks (2887041024 bytes), maxio 128]
  16. [root@station87 ~]# ls -l /dev/oracleasm/disks/*
  17. brw-rw---- 1 oracle dba 253, 3 May 30 03:20 /dev/oracleasm/disks/DISK1
  18. brw-rw---- 1 oracle dba 253, 5 May 30 03:20 /dev/oracleasm/disks/DISK2
  19. brw-rw---- 1 oracle dba 253, 6 May 30 03:20 /dev/oracleasm/disks/DISK3
  20. brw-rw---- 1 oracle dba 253, 7 May 30 03:20 /dev/oracleasm/disks/DISK4
  21. brw-rw---- 1 oracle dba 253, 8 May 30 03:20 /dev/oracleasm/disks/DISK5
  22. [root@station87 ~]# losetup  /dev/loop0
  23. /dev/loop0: [fc01]:2815299 (/u01/loop/device/loop0.img)
  24. [root@station87 ~]# losetup  /dev/loop1
  25. /dev/loop1: [fc01]:2815300 (/u01/loop/device/loop1.img)
  26. [root@station87 ~]# losetup  /dev/loop2
  27. /dev/loop2: [fc01]:2815301 (/u01/loop/device/loop2.img)
  28. [root@station87 ~]# losetup  /dev/loop3
  29. /dev/loop3: [fc01]:2815302 (/u01/loop/device/loop3.img)
  30. [root@station87 ~]# losetup  /dev/loop4
  31. /dev/loop4: [fc01]:2815303 (/u01/loop/device/loop4.img)
  32. [root@station87 ~]# vim /etc/rc.local
  33. [root@station87 ~]# cd /u01/loop/
  34. [root@station87 loop]# ls
  35. device
  36. [root@station87 loop]# cd device/
  37. [root@station87 device]# pwd
  38. /u01/loop/device
  39. [root@station87 device]# ls
  40. loop0.img  loop1.img  loop2.img  loop3.img  loop4.img
  41. [root@station87 device]# du -sh *
  42. 2.7G    loop0.img
  43. 2.7G    loop1.img
  44. 513M    loop2.img
  45. 513M    loop3.img
  46. 513M    loop4.img
  47. [root@station87 device]# oracleasm-discover
  48. Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
  49. [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
  50. Discovered disk: ORCL:DISK1 [12289725 blocks (6292339200 bytes), maxio 128]
  51. Discovered disk: ORCL:DISK2 [5638752 blocks (2887041024 bytes), maxio 128]
  52. Discovered disk: ORCL:DISK3 [5638752 blocks (2887041024 bytes), maxio 128]
  53. Discovered disk: ORCL:DISK4 [5638752 blocks (2887041024 bytes), maxio 128]
  54. Discovered disk: ORCL:DISK5 [5638752 blocks (2887041024 bytes), maxio 128]
  55. [root@station87 device]# oracleasm createdisk  DISK6 /dev/loop0
  56. Writing disk header: done
  57. Instantiating disk: done
  58. [root@station87 device]# oracleasm createdisk  DISK7 /dev/loop1
  59. Writing disk header: done
  60. Instantiating disk: done
  61. [root@station87 device]# oracleasm createdisk  DISK8 /dev/loop2
  62. Writing disk header: done
  63. Instantiating disk: done
  64. [root@station87 device]# oracleasm createdisk  DISK9 /dev/loop3
  65. Writing disk header: done
  66. Instantiating disk: done
  67. [root@station87 device]# oracleasm createdisk  DISK10 /dev/loop4
  68. Writing disk header: done
  69. Instantiating disk: done
  70. [root@station87 device]# oracleasm-discover
  71. Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
  72. [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
  73. Discovered disk: ORCL:DISK1 [12289725 blocks (6292339200 bytes), maxio 128]
  74. Discovered disk: ORCL:DISK10 [1048576 blocks (536870912 bytes), maxio 128]
  75. Discovered disk: ORCL:DISK2 [5638752 blocks (2887041024 bytes), maxio 128]
  76. Discovered disk: ORCL:DISK3 [5638752 blocks (2887041024 bytes), maxio 128]
  77. Discovered disk: ORCL:DISK4 [5638752 blocks (2887041024 bytes), maxio 128]
  78. Discovered disk: ORCL:DISK5 [5638752 blocks (2887041024 bytes), maxio 128]
  79. Discovered disk: ORCL:DISK6 [5632000 blocks (2883584000 bytes), maxio 128]
  80. Discovered disk: ORCL:DISK7 [5632000 blocks (2883584000 bytes), maxio 128]
  81. Discovered disk: ORCL:DISK8 [1048576 blocks (536870912 bytes), maxio 128]
  82. Discovered disk: ORCL:DISK9 [1048576 blocks (536870912 bytes), maxio 128]
  83. [root@station87 device]#
复制代码

+ASM实例里头再看盘:

  1. select  * from v$asm_disk
  2.   where mount_status <>'IGNORED'
  3.    and library='ASM Library - Generic Linux, version 2.0.4 (KABI_V2)'
  4.   order by group_number;
复制代码

+ASM实例里看各种类型的磁盘组:

  1. select  * from v$asm_diskgroup;

  2. create diskgroup highdata high redundancy
  3. failgroup fg1
  4.    disk 'ORCL:DISK7' name fg1_dsk1
  5. failgroup fg2
  6.     disk 'ORCL:DISK8' name fg2_dsk1
  7. failgroup fg3
  8.     disk 'ORCL:DISK9' name fg3_dsk1;
  9.    
复制代码

磁盘组自己的属性:

  1. select  * from V$ASM_ATTRIBUTE        
  2. order by group_number;

  3. alter diskgroup highdata set attribute 'compatible.asm'='11.2.0';
复制代码

orcl成为highdata的client:
  1. create tablespace tbs05205_a  datafile '+highdata' size 10M;
复制代码
  1. select  * from v$asm_client
  2. where group_number=3;
复制代码

orcl看数据文件:

  1. select  * from dba_data_files d
  2. where d.tablespace_name='TBS05205_A';
复制代码

+ASM看同一个数据文件(自动套上数据文件模板:三路冗余,粗糙分条):


  1. select  * from v$asm_alias
  2. where lower(name)='tbs05205_a.256.977632347';

  3. select  * from v$asm_file
  4.   where group_number=3 and file_number=256;
  5.    
  6. select  * from v$asm_template where group_number=3;

  7. alter diskgroup  highdata add template temp1 attribute ( mirror  fine  );

  8. Diskgroup altered.

  9. alter diskgroup  highdata add template temp2 attribute (  unprotected  fine  );
  10.   alter diskgroup  highdata add template temp2 attribute (  unprotected  fine  )
  11. *
  12. ERROR at line 1:
  13. ORA-15067: command or option incompatible with diskgroup redundancy
复制代码

ORCL套模板:
  1. create tablespace tbs05205_b datafile '+highdata(temp1)'   size 10M ;
复制代码
+ASM验证文件:
  1. select  * from dba_data_files d
  2. where d.tablespace_name='TBS05205_B';
复制代码
  1. select  * from v$asm_alias
  2. where lower(name)='tbs05205_b.257.977633555';

  3. select  * from v$asm_file
  4.   where group_number=3 and file_number=257;
复制代码

人为做别名:

  1. select  * from v$asm_alias where lower(name) like '%tbs05205_b%';
复制代码

删除/重建磁盘组:
  1. SQL> drop diskgroup highdata ;
  2. drop diskgroup highdata
  3. *
  4. ERROR at line 1:
  5. ORA-15039: diskgroup not dropped
  6. ORA-15053: diskgroup "HIGHDATA" contains existing files


  7. SQL> drop diskgroup highdata ;
  8. drop diskgroup highdata
  9. *
  10. ERROR at line 1:
  11. ORA-15039: diskgroup not dropped
  12. ORA-15053: diskgroup "HIGHDATA" contains existing files


  13. SQL> drop diskgroup highdata  including contents ;


  14. create diskgroup highdata high redundancy
  15. failgroup fg1
  16.    disk 'ORCL:DISK8' name fg1_dsk1
  17. failgroup fg2
  18.     disk 'ORCL:DISK9' name fg2_dsk1
  19. failgroup fg3
  20.     disk 'ORCL:DISK10' name fg3_dsk1  
  21. attribute  'au_size'='4194304';
复制代码

添加删除磁盘,同时观察重平衡:

watch -n  0.1 "ps aux | grep asm_arb"

  1. select * from v$asm_operation;

  2. select  * from v$asm_disk
  3.   where mount_status <>'IGNORED'
  4.    and library='ASM Library - Generic Linux, version 2.0.4 (KABI_V2)'
  5.    and group_number=1;
  6.    
  7.    select  name , usable_file_mb  from v$asm_diskgroup
  8.     where group_number=1;

  9. alter diskgroup data add   failgroup    DATA_0004
  10. disk 'ORCL:DISK6' name DATA_0004  size     2750M
  11.                                      failgroup data_0005
  12.       disk 'ORCL:DISK7' name DATA_0005  size     2750M  
  13.         rebalance power 11;                           
复制代码

快速镜像重同步:
  1. SQL> alter diskgroup data  offline disk data_0000  drop after 3.6h ;
  2. alter diskgroup data  offline disk data_0000  drop after 3.6h
  3. *
  4. ERROR at line 1:
  5. ORA-15032: not all alterations performed
  6. ORA-15283: ASM operation requires compatible.rdbms of 11.1.0.0.0 or higher


  7. SQL> alter diskgroup data set attribute 'compatible.rdbms'='11.1.0.0.0';

  8. Diskgroup altered.

  9. SQL> alter diskgroup data set attribute 'compatible.rdbms'='10.1.0.0.0';
  10. alter diskgroup data set attribute 'compatible.rdbms'='10.1.0.0.0'
  11. *
  12. ERROR at line 1:
  13. ORA-15032: not all alterations performed
  14. ORA-15242: could not set attribute compatible.rdbms
  15. ORA-15244: new compatibility setting less than current [11.1.0.0.0]


  16. SQL> alter diskgroup data  offline disk data_0000  drop after 3.6h ;

  17. Diskgroup altered.

  18. SQL> alter diskgroup data  online disk data_0000  ;

  19. Diskgroup altered.

  20. SQL> alter diskgroup data  offline disk data_0000  drop after 3.6h ;

  21. Diskgroup altered.

  22. SQL> alter diskgroup data  online disk data_0000  ;
  23. alter diskgroup data  online disk data_0000
  24. *
  25. ERROR at line 1:
  26. ORA-15032: not all alterations performed
  27. ORA-15281: not all specified disks were brought ONLINE
  28. ORA-15284: ASM terminated ALTER DISKGROUP ONLINE
  29. ORA-15282: ASM disk "DATA_0000" is not visible cluster-wide


  30. SQL> alter diskgroup data drop disk data_0000  ;
  31. alter diskgroup data drop disk data_0000
  32. *
  33. ERROR at line 1:
  34. ORA-15032: not all alterations performed
  35. ORA-15084: ASM disk "DATA_0000" is offline and cannot be dropped.


  36. SQL> alter diskgroup data drop disk data_0000  force ;

  37. Diskgroup altered.

  38. SQL> alter diskgroup data add   failgroup data_0000  disk  'ORCL:DISK2' name data_0000  ;

  39. Diskgroup altered.

  40. SQL>
复制代码







回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Botang唐波's Oracle Station   

GMT+8, 2018-6-23 00:45 , Processed in 0.109461 second(s), 23 queries .

快速回复 返回顶部 返回列表