一.检查ASMLIB是否安装成功:
检查驱动加载情况:
[root@rhel1 disks]# lsmod | grep oracleasm
oracleasm 84136 1
检查oracleasmfs文件系统:
[root@rhel1 disks]# df -a |head -1;df -a | grep oracleasm
文件系统 1K-块 已用 可用 已用% 挂载点
oracleasmfs 0 0 0 - /dev/oracleasm
[root@rhel1 disks]# cat /proc/filesystems | grep oracleasm
nodev oracleasmfs
asm disk创建成功后,会在/dev/oracleasm/disks目录下有相应的文件:
[root@rhel1 disks]# pwd
/dev/oracleasm/disks
[root@rhel1 disks]# ls
VOL1 VOL2 VOL3
如果在asmlib使用过程中有报错,可以查看详细的日志信息:
/var/log/oracleasm
二.参数介绍:
instance_type=[RDBMS | ASM]
如果是ASM的话,该参数一定要是ASM。
asm_power_limit=[1 - 11]
指定了磁盘自动平衡负载的等级,数字越大,表示自动均衡能力越强。
asm_diskstring
指定了ASM实例启动时自动寻找磁盘的特征。如参数设置为/dev/mapper/*,那么ASM实例在disk group添加磁盘时会默认把所有/dev/mapper目录下的磁盘都显示出来,默认情况为NULL,也就是所有磁盘设备都显示出来。
asm_diskgroups
指定实例启动时自动MOUNT的磁盘组。
三.日常维护:
[root@rhel1 /]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@rhel1 /]# /etc/init.d/oracleasm listdisks
VOL1
[root@rhel1 /]# /etc/init.d/oracleasm querydisk -p VOL1
Disk "VOL1" is a valid ASM disk
/dev/sdb6: LABEL="VOL1" TYPE="oracleasm"
[root@rhel1 /]# fdisk -l /dev/sdb6
Disk /dev/sdb6: 4055 MB, 4055030784 bytes
255 heads, 63 sectors/track, 492 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb6 doesn't contain a valid partition table
SQL> set linesize 200
SQL> col name format a30
SQL> col path format a30
SQL> select group_number,disk_number,name,path from v$asm_disk;
GROUP_NUMBER DISK_NUMBER NAME PATH
------------ ----------- ------------------------------ ------------------------------
1 0 ASM1 ORCL:VOL1
SQL> select group_number,name,type,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME TYPE TOTAL_MB FREE_MB
------------ ------------------------------ ------ ---------- ----------
1 DG1 EXTERN 3867 910
[root@rhel1 sbin]# ./oracleasm createdisk VOL2 /dev/sdb8
Writing disk header: done
Instantiating disk: done
[root@rhel1 sbin]# ./oracleasm createdisk VOL3 /dev/sdb9
Writing disk header: done
Instantiating disk: done
[root@rhel1 sbin]# ./oracleasm createdisk VOL4 /dev/sdb10
Writing disk header: done
Instantiating disk: done
[root@rhel1 sbin]# ./oracleasm createdisk VOL5 /dev/sdb11
Writing disk header: done
Instantiating disk: done
[root@rhel1 sbin]# ./oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@rhel1 sbin]# ./oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
VOL5
[oracle@rhel1 ~]$ export ORACLE_SID=+ASM1
[oracle@rhel1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Mar 2 03:03:44 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> alter diskgroup DG1 add disk '/dev/oracleasm/disks/VOL2' name data02;
alter diskgroup DG1 add disk '/dev/oracleasm/disks/VOL2' name data02
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15031: disk specification '/dev/oracleasm/disks/VOL2' matches no disks
ORA-15014: location '/dev/oracleasm/disks/VOL2' is not in the discovery set
SQL> alter diskgroup DG1 add disk 'ORCL:VOL2' name data02;
Diskgroup altered.
ORCL关键字说明:
Linux ASMLib 的发现字符串
ASMLib 使用发现字符串来确定 ASM 正在请求哪些磁盘。一般的 Linux ASMLib 使用 glob 字符串。字符串必须以 "ORCL:" 为前缀。磁盘通过名称来指定。可以通过发现字符串 "ORCL:VOL1" 在 ASM 中,发现以名称 "VOL1" 创建的磁盘。类似地,可以用发现字符串 "ORCL:VOL*" 来查询所有以字符串 "VOL" 开始的磁盘。
不能在发现字符串中用路径名称来发现磁盘。如果缺少前缀,那么一般的 Linux ASMLib 将完全忽略发现字符串,认为它适用于一个不同的 ASMLib。唯一的例外是空字符串 (""),它被认为是一个全通配符。这与发现字符串 "ORCL:*" 完全等价。
[root@rhel1 sbin]# su - oracle
[oracle@rhel1 ~]$ export ORACLE_SID=+ASM1
[oracle@rhel1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Apr 25 17:29:57 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> create diskgroup dg2 external redundancy disk 'ORCL:VOL3';
Diskgroup created.
SQL> select path from v$asm_disk;
PATH
--------------------------------------------------------------------------------
ORCL:VOL1
ORCL:VOL2
ORCL:VOL3
SQL> col name format a20;
SQL> select name,state from v$asm_diskgroup;
NAME STATE
-------------------- ----------------------
DG1 MOUNTED
FLASHAREA1 MOUNTED
DG2 MOUNTED
SQL> drop diskgroup dg2 including contents;
Diskgroup dropped.
SQL> alter diskgroup dg1 add disk 'ORCL:VOL3';
Diskgroup altered.
SQL> alter diskgroup dg1 rebalance power 11;
Diskgroup altered.
SQL> alter diskgroup dg1 check all;
Diskgroup altered.
SQL> alter diskgroup dg1 check all repair;
Diskgroup altered.
SQL> select path from v$asm_disk where group_number in (select group_number from v$asm_diskgroup where name='DG1');
PATH
--------------------------------------------------------------------------------
ORCL:VOL1
ORCL:VOL3
SQL> alter diskgroup dg1 drop disk 'VOL3'; //注意这里是DISK的名字v$asm_disk.name
Diskgroup altered.
SQL> select name from v$asm_diskgroup;
NAME
--------------------
DG1
FLASHAREA1
SQL> select name from v$asm_disk;
NAME
--------------------
DGDISK1
FLASHAREADISK01
SQL> create diskgroup dg2 external redundancy disk 'ORCL:VOL3';
Diskgroup created.
1970 1970
State Type Rebal Unbal Sector Block AU Total_MB Free_MB
Req_mir_free_MB Usable_file_MB Offline_disks Name
MOUNTED EXTERN N N 512 4096 1048576 1961 0 0
0 0 DG1/
MOUNTED EXTERN N N 512 4096 1048576 1961 1911 0
1911 0 DG2/
MOUNTED EXTERN N N 512 4096 1048576 1961 1764 0
1764 0 FLASHAREA1/
ASMCMD> lsct
DB_Name Status Software_Version Compatible_version Instance_Name
ractest CONNECTED 10.2.0.4.0 10.2.0.3.0 ractest1
ractest CONNECTED 10.2.0.4.0 10.2.0.3.0 ractest1
ASMCMD> ls
DG1/
DG2/
FLASHAREA1/
ASMCMD> cd +/ //回到根目录
五.相关动态性能视图
SQL> select instance_name,db_name,status from v$asm_client; //查看是否有数据库实例连接上ASM实例
------------------------------ -------- ------------
+ASM2 ractest CONNECTED
+ASM2 ractest CONNECTED
SQL> select operation,state,power,actual,sofar from v$asm_operation;//记录BALANCE操作
SQL> col path format a20;
SQL> select path, state, total_mb, free_mb from v$asm_disk;//ASM DISK
-------------------- -------- ---------- ----------
ORCL:VOL1 NORMAL 1961 0
ORCL:VOL2 NORMAL 1961 0
------------------------------ ----------- ------ ---------- ----------
DG1 CONNECTED EXTERN 1961 0
FLASHAREA1 CONNECTED EXTERN 1961 1764
DG2 DISMOUNTED 0 0
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23135684/viewspace-628169/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23135684/viewspace-628169/