grid与Oracle用户下Oracle程序权限不一致导致无法连接ASM问题

chenhuizhuchz 2018-01-26

在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类似,只是执行程序时获得的是文件属组的权限。

相关推荐