grid與Oracle使用者下Oracle程式許可權不一致導致無法串連ASM問題
在RAC中,啟動資料庫時遇到如下報錯:
Oracle instance started.
Total System Global Area 807682048 bytes
Fixed Size 1347964 bytes
Variable Size 549457540 bytes
Database Buffers 251658240 bytes
Redo Buffers 5218304 bytes
ORA-00205: error in identifying control file, check alert log for more info
查看日誌,錯誤如下:
Fatal NI connect error 12547, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=beq)(PROGRAM=/u01/app/11.2.0/grid/bin/oracle)(ARGV0=oracle+ASM2_asmb_gzyt2)(ENVS='ORACLE_HOME=/u01/app/11.2.0/grid,ORACLE_SID=+ASM2')(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))(enable=setuser)(CONNECT_DATA=(CID=(PROGRAM=oracle@node2)(HOST=node2)(USER=oracle))))
VERSION INFORMATION:
TNS for Linux: Version 11.2.0.3.0 - Production
Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.3.0 - Production
Time: 23-JAN-2018 22:11:58
Tracing not turned on.
Tns error struct:
ns main err code: 12547
TNS-12547: TNS:lost contact
ns secondary err code: 12560
nt main err code: 517
TNS-00517: Lost contact
nt secondary err code: 32
nt OS err code: 0
ERROR: Failed to connect with connect string: (DESCRIPTION=(ADDRESS=(PROTOCOL=beq)(PROGRAM=/u01/app/11.2.0/grid/bin/oracle)(ARGV0=oracle+ASM2_asmb_gzyt2)(ENVS='ORACLE_HOME=/u01/app/11.2.0/grid,ORACLE_SID=+ASM2')(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))(enable=setuser))
排查:
1.ASM磁碟組已經正常掛載:
複製代碼
SQL> select name,state from v$asm_diskgroup;
NAME STATE
-------------------------------------------------- -----------
DATA MOUNTED
FRA MOUNTED
OCRVOTE MOUNTED
2.資料庫alert日誌:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '+FRA/gzyt/controlfile/current.256.966128177'
ORA-17503: ksfdopn:2 Failed to open file +FRA/gzyt/controlfile/current.256.966128177
ORA-15001: diskgroup "FRA" does not exist or is not mounted
ORA-15055: unable to connect to ASM instance
ORA-12547: TNS:lost contact
問題解決:
1.查看ORACLE程式的許可權:
[oracle@node1 ~]$ ls -l /u01/app/oracle/product/11.2.0/db_1/bin/oracle
-rwsr-s--x 1 oracle oinstall 239626665 Jan 6 10:59 oracle
[grid@node1 ~]$ ls -l /u01/app/11.2.0/grid/bin/oracle
-rwxr-x--x 1 grid oinstall 209914471 Jan 6 10:33 oracle
2.修改許可權為6751後,恢複正常:
[oracle@node1 ~]$ ls -l /u01/app/oracle/product/11.2.0/db_1/bin/oracle
-rwsr-s--x 1 oracle oinstall 239626665 Jan 6 10:59 oracle
[grid@node1 ~]$ ls -l /u01/app/11.2.0/grid/bin/oracle
-rwsr-s--x 1 grid oinstall 209914471 Jan 6 10:33 oracle
3.在安裝僅oracle software之後,$ORACLE_HOME/bin/oracle檔案屬性許可權為751(-rwxr-x--x)
在用安裝ASM建庫(DBCA)時,此檔案屬性會自動被修改為6751(-rwsr-s--x)
--此許可權問題也有可能導致ORA-12537: TNS:connection closed
--此許可權問題也有可能導致使用DBCA建庫時無法找到ASM磁碟
4.關於6751許可權的說明:
6751分別指定了ugoa的許可權:
第一位6代表u(所有者)有讀、寫入權限,沒有執行許可權
第二位7代表g(組)有讀、寫、執行許可權
第三位5代表o(其它使用者)有讀、執行許可權
第四位1代表a(所有者、組、其它使用者)有執行許可權
四位6751如果用三位表示就是675,第四位繼承umask的值
Linux 許可權模型有兩個專門的位,叫做“suid”和“sgid”。當設定了一個可執行程式
的“suid”這一位時,在使用者執行該程式時,使用者的許可權是該程式檔案屬主的許可權。例如程式檔案的屬主是root,那麼執行該程式的使用者就將暫時獲得root賬戶的許可權。sgid與suid類似,只是執行程式時獲得的是檔案屬組的許可權。