裝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 詳解
這次一次通過了。
(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.