|
Linux上看盘:
- [root@station87 ~]# rpm -qa | grep oracleasm
- oracleasm-2.6.18-238.el5PAE-2.0.5-1.el5
- oracleasm-2.6.18-238.el5debug-2.0.5-1.el5
- oracleasm-2.6.18-238.el5xen-2.0.5-1.el5
- oracleasm-2.6.18-238.el5-2.0.5-1.el5
- oracleasm-support-2.1.8-1.el5
- oracleasmlib-2.0.4-1.el5
- [root@station87 ~]# oracleasm-discover
- Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
- [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
- Discovered disk: ORCL:DISK1 [12289725 blocks (6292339200 bytes), maxio 128]
- Discovered disk: ORCL:DISK2 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK3 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK4 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK5 [5638752 blocks (2887041024 bytes), maxio 128]
- [root@station87 ~]# ls -l /dev/oracleasm/disks/*
- brw-rw---- 1 oracle dba 253, 3 May 30 03:20 /dev/oracleasm/disks/DISK1
- brw-rw---- 1 oracle dba 253, 5 May 30 03:20 /dev/oracleasm/disks/DISK2
- brw-rw---- 1 oracle dba 253, 6 May 30 03:20 /dev/oracleasm/disks/DISK3
- brw-rw---- 1 oracle dba 253, 7 May 30 03:20 /dev/oracleasm/disks/DISK4
- brw-rw---- 1 oracle dba 253, 8 May 30 03:20 /dev/oracleasm/disks/DISK5
- [root@station87 ~]# losetup /dev/loop0
- /dev/loop0: [fc01]:2815299 (/u01/loop/device/loop0.img)
- [root@station87 ~]# losetup /dev/loop1
- /dev/loop1: [fc01]:2815300 (/u01/loop/device/loop1.img)
- [root@station87 ~]# losetup /dev/loop2
- /dev/loop2: [fc01]:2815301 (/u01/loop/device/loop2.img)
- [root@station87 ~]# losetup /dev/loop3
- /dev/loop3: [fc01]:2815302 (/u01/loop/device/loop3.img)
- [root@station87 ~]# losetup /dev/loop4
- /dev/loop4: [fc01]:2815303 (/u01/loop/device/loop4.img)
- [root@station87 ~]# vim /etc/rc.local
- [root@station87 ~]# cd /u01/loop/
- [root@station87 loop]# ls
- device
- [root@station87 loop]# cd device/
- [root@station87 device]# pwd
- /u01/loop/device
- [root@station87 device]# ls
- loop0.img loop1.img loop2.img loop3.img loop4.img
- [root@station87 device]# du -sh *
- 2.7G loop0.img
- 2.7G loop1.img
- 513M loop2.img
- 513M loop3.img
- 513M loop4.img
- [root@station87 device]# oracleasm-discover
- Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
- [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
- Discovered disk: ORCL:DISK1 [12289725 blocks (6292339200 bytes), maxio 128]
- Discovered disk: ORCL:DISK2 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK3 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK4 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK5 [5638752 blocks (2887041024 bytes), maxio 128]
- [root@station87 device]# oracleasm createdisk DISK6 /dev/loop0
- Writing disk header: done
- Instantiating disk: done
- [root@station87 device]# oracleasm createdisk DISK7 /dev/loop1
- Writing disk header: done
- Instantiating disk: done
- [root@station87 device]# oracleasm createdisk DISK8 /dev/loop2
- Writing disk header: done
- Instantiating disk: done
- [root@station87 device]# oracleasm createdisk DISK9 /dev/loop3
- Writing disk header: done
- Instantiating disk: done
- [root@station87 device]# oracleasm createdisk DISK10 /dev/loop4
- Writing disk header: done
- Instantiating disk: done
- [root@station87 device]# oracleasm-discover
- Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
- [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
- Discovered disk: ORCL:DISK1 [12289725 blocks (6292339200 bytes), maxio 128]
- Discovered disk: ORCL:DISK10 [1048576 blocks (536870912 bytes), maxio 128]
- Discovered disk: ORCL:DISK2 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK3 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK4 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK5 [5638752 blocks (2887041024 bytes), maxio 128]
- Discovered disk: ORCL:DISK6 [5632000 blocks (2883584000 bytes), maxio 128]
- Discovered disk: ORCL:DISK7 [5632000 blocks (2883584000 bytes), maxio 128]
- Discovered disk: ORCL:DISK8 [1048576 blocks (536870912 bytes), maxio 128]
- Discovered disk: ORCL:DISK9 [1048576 blocks (536870912 bytes), maxio 128]
- [root@station87 device]#
复制代码
+ASM实例里头再看盘:
- select * from v$asm_disk
- where mount_status <>'IGNORED'
- and library='ASM Library - Generic Linux, version 2.0.4 (KABI_V2)'
- order by group_number;
复制代码
+ASM实例里看各种类型的磁盘组:
- select * from v$asm_diskgroup;
- create diskgroup highdata high redundancy
- failgroup fg1
- disk 'ORCL:DISK7' name fg1_dsk1
- failgroup fg2
- disk 'ORCL:DISK8' name fg2_dsk1
- failgroup fg3
- disk 'ORCL:DISK9' name fg3_dsk1;
-
复制代码
磁盘组自己的属性:
- select * from V$ASM_ATTRIBUTE
- order by group_number;
- alter diskgroup highdata set attribute 'compatible.asm'='11.2.0';
复制代码
orcl成为highdata的client:
- create tablespace tbs05205_a datafile '+highdata' size 10M;
复制代码- select * from v$asm_client
- where group_number=3;
复制代码
orcl看数据文件:
- select * from dba_data_files d
- where d.tablespace_name='TBS05205_A';
复制代码
+ASM看同一个数据文件(自动套上数据文件模板:三路冗余,粗糙分条):
- select * from v$asm_alias
- where lower(name)='tbs05205_a.256.977632347';
-
- select * from v$asm_file
- where group_number=3 and file_number=256;
-
- select * from v$asm_template where group_number=3;
- alter diskgroup highdata add template temp1 attribute ( mirror fine );
- Diskgroup altered.
- alter diskgroup highdata add template temp2 attribute ( unprotected fine );
- alter diskgroup highdata add template temp2 attribute ( unprotected fine )
- *
- ERROR at line 1:
- ORA-15067: command or option incompatible with diskgroup redundancy
复制代码
ORCL套模板:
- create tablespace tbs05205_b datafile '+highdata(temp1)' size 10M ;
复制代码 +ASM验证文件:
- select * from dba_data_files d
- where d.tablespace_name='TBS05205_B';
复制代码- select * from v$asm_alias
- where lower(name)='tbs05205_b.257.977633555';
-
- select * from v$asm_file
- where group_number=3 and file_number=257;
复制代码
人为做别名:
-
- select * from v$asm_alias where lower(name) like '%tbs05205_b%';
复制代码
删除/重建磁盘组:
- SQL> drop diskgroup highdata ;
- drop diskgroup highdata
- *
- ERROR at line 1:
- ORA-15039: diskgroup not dropped
- ORA-15053: diskgroup "HIGHDATA" contains existing files
- SQL> drop diskgroup highdata ;
- drop diskgroup highdata
- *
- ERROR at line 1:
- ORA-15039: diskgroup not dropped
- ORA-15053: diskgroup "HIGHDATA" contains existing files
- SQL> drop diskgroup highdata including contents ;
- create diskgroup highdata high redundancy
- failgroup fg1
- disk 'ORCL:DISK8' name fg1_dsk1
- failgroup fg2
- disk 'ORCL:DISK9' name fg2_dsk1
- failgroup fg3
- disk 'ORCL:DISK10' name fg3_dsk1
- attribute 'au_size'='4194304';
复制代码
添加删除磁盘,同时观察重平衡:
watch -n 0.1 "ps aux | grep asm_arb"
- select * from v$asm_operation;
- select * from v$asm_disk
- where mount_status <>'IGNORED'
- and library='ASM Library - Generic Linux, version 2.0.4 (KABI_V2)'
- and group_number=1;
-
- select name , usable_file_mb from v$asm_diskgroup
- where group_number=1;
-
- alter diskgroup data add failgroup DATA_0004
- disk 'ORCL:DISK6' name DATA_0004 size 2750M
- failgroup data_0005
- disk 'ORCL:DISK7' name DATA_0005 size 2750M
- rebalance power 11;
复制代码
快速镜像重同步:
- SQL> alter diskgroup data offline disk data_0000 drop after 3.6h ;
- alter diskgroup data offline disk data_0000 drop after 3.6h
- *
- ERROR at line 1:
- ORA-15032: not all alterations performed
- ORA-15283: ASM operation requires compatible.rdbms of 11.1.0.0.0 or higher
- SQL> alter diskgroup data set attribute 'compatible.rdbms'='11.1.0.0.0';
- Diskgroup altered.
- SQL> alter diskgroup data set attribute 'compatible.rdbms'='10.1.0.0.0';
- alter diskgroup data set attribute 'compatible.rdbms'='10.1.0.0.0'
- *
- ERROR at line 1:
- ORA-15032: not all alterations performed
- ORA-15242: could not set attribute compatible.rdbms
- ORA-15244: new compatibility setting less than current [11.1.0.0.0]
- SQL> alter diskgroup data offline disk data_0000 drop after 3.6h ;
- Diskgroup altered.
- SQL> alter diskgroup data online disk data_0000 ;
- Diskgroup altered.
- SQL> alter diskgroup data offline disk data_0000 drop after 3.6h ;
- Diskgroup altered.
- SQL> alter diskgroup data online disk data_0000 ;
- alter diskgroup data online disk data_0000
- *
- ERROR at line 1:
- ORA-15032: not all alterations performed
- ORA-15281: not all specified disks were brought ONLINE
- ORA-15284: ASM terminated ALTER DISKGROUP ONLINE
- ORA-15282: ASM disk "DATA_0000" is not visible cluster-wide
- SQL> alter diskgroup data drop disk data_0000 ;
- alter diskgroup data drop disk data_0000
- *
- ERROR at line 1:
- ORA-15032: not all alterations performed
- ORA-15084: ASM disk "DATA_0000" is offline and cannot be dropped.
- SQL> alter diskgroup data drop disk data_0000 force ;
- Diskgroup altered.
- SQL> alter diskgroup data add failgroup data_0000 disk 'ORCL:DISK2' name data_0000 ;
- Diskgroup altered.
- SQL>
复制代码
|
|