装RAC时,用DBCA命令创建了ASM 实例,之后创建diskgroup的时候,有一个节点的diskgroup 挂不上,看了下日志,错误如下:
ORA-15186: ASMLIB error function = [asm_open], error = [1], mesg = [Operation not permitted]
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "FRA"
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA"
不过错误是提示是很恶心的,误导了我很长时间:
Ensure that the listener is runing on this node and the ASM instance is registered to the listener.
一度以为是监听的问题。 不过后来发现还是权限问题。
总的来说,导致不能mount 的原因,有两方面原因:
(1)Oracle ASM database instance parameter asm_diskstring is unset
(2)Oracle ASM database instance parameter asm_diskstring was recently modified to include devices or directories that it has no privilege to access
1. 对应Device 的权限问题
Device 需要oracle 用户的权限。
[oracle@rac1 mapper]$ ll
brw-rw---- 1 oracle oinstall 253, 3 Mar 21 15:01 data
brw-rw---- 1 oracle oinstall 253, 12 Mar 24 13:40 datap1
brw-rw---- 1 oracle oinstall 253, 2 Mar 21 15:01 fra
brw-rw---- 1 oracle oinstall 253, 8 Mar 24 13:40 frap1
不过一般安装的时候,默认是root:disk. 使用命令修改一下:
$chown oracle:oinstall device_name
2. asm_diskstring 参数的问题
这个参数也会导致权限的问题。这个参数是支持通配符的。我开始一直设置成 ORCL:*, 如:
SQL> show parameter asm_diskstring
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string ORCL:*
这些设置之后,在创建磁盘组的时候是能够识别的,但是在第二个节点挂载的时候,就报开始提到的错误了。 把整个ASM 删除了2次,重建了2次,问题依旧。 无耐,没有设置通配符了。
(1)先讲所有已经挂载的磁盘dismout
SQL>alter diskgroup all dismount
(2)重新指定asm_diskstring:
SQL> alter system set asm_diskstring='/dev/mapper/datap1','/dev/mapper/frap1';
(3)dbca 继续挂载,当然也可以手工的创建磁盘组。
参考:
Oracle ASM 详解
http://blog.csdn.net/xujinyang/article/details/6837288
这次一次通过了。
(4) shutdown ASM实例,重启启动。
我们之前的的修改是只对内存生效,所以如果ASM重启,就没有了。所以需要修改pfile,在重启。
[oracle@rac1 dbs]$ pwd
/u01/app/oracle/product/10.2.0/db_1/dbs
[oracle@rac1 dbs]$ vi init+ASM2.ora
asm_diskstring='/dev/mapper/datap1','/dev/mapper/frap1'
注意:
$ORACLE_HOME下的init+ASM2.ora 只是一个link,
[oracle@rac1 dbs]$ ls -lrt init+ASM2.ora
lrwxrwxrwx 1 oracle oinstall 41 Mar 24 12:49 init+ASM2.ora -> /u01/app/oracle/admin/+ASM/pfile/init.ora
SQL> startup
ASM instance started
Total System Global Area 92274688 bytes
Fixed Size 1217884 bytes
Variable Size 65890980 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> col name format a10
SQL> select GROUP_NUMBER,NAME,STATE,TYPE,TOTAL_MB,FREE_MB,
2 UNBALANCED from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB U
------------ ---------- ----------- ------ ---------- ---------- -
1 DATA MOUNTED EXTERN 11993 11900 N
2 FRA MOUNTED EXTERN 7993 7900 N
3. ASM_DISKSTRING 参数说明
The ASM_DISKSTRING initialization parameter specifies a comma-delimited list of strings that limits the set of disks that an Oracle ASM instance discovers. The discovery strings can include wildcard characters. Only disks that match one of the strings are discovered. The same disk cannot be discovered twice.
The discovery string format depends on the Oracle ASM library and the operating system that are in use. Pattern matching is supported. Refer to your operating system-specific installation guide for information about the default pattern matching.
For example, on a Linux server that does not use ASMLIB, to limit the discovery process to only include disks that are in the /dev/rdsk/mydisks directory, set theASM_DISKSTRING initialization parameter to:
/dev/rdsk/mydisks/*
The asterisk is required. To limit the discovery process to only include disks that have a name that ends in disk3 or disk4, set ASM_DISKSTRING to:
/dev/rdsk/*disk3, /dev/rdsk/*disk4
The ? character, when used as the first character of a path, expands to the Oracle home directory. Depending on the operating system, when you use the ? character elsewhere in the path, it is a wildcard for one character.
The default value of the ASM_DISKSTRING parameter is a NULL string. A NULL value causes Oracle ASM to search a default path for all disks in the system to which the Oracle ASM instance has read and write access. The default search path is platform-specific. Refer to your operating system specific installation guide for more information about the default search path.
Oracle ASM cannot use a disk unless all of the Oracle ASM instances in the cluster can discover the disk through one of their own discovery strings. The names do not have to be the same on every node, but all disks must be discoverable by all of the nodes in the cluster. This may require dynamically changing the initialization parameter to enable adding new storage.
---------------------------------------------------------------------------------------------------