修改文件目录权限导致数据库连接报错
1,使用oracle用户sysdba登录数据库报错ORA-12547
-bash-3.2$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on 星期五 1月 4 16:59:26 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12547: TNS: 丢失连接
-bash-3.2$ oerr ora 12547
12547, 00000, "TNS:lost contact"
// *Cause: Partner has unexpectedly gone away, usually during process
// startup.
// *Action: Investigate partner application for abnormal termination. On an
// Interchange, this can happen if the machine is overloaded.
2,此时查看listener的配置,service不是很正常,blocked
[grid@dtydb3 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 04-JAN-2013 17:14:56
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 04-JAN-2013 17:13:34
Uptime 0 days 0 hr. 1 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP ON
Listener Parameter File /oracle/11.2.0/grid/network/admin/listener.ora
Listener Log File /oracle/11.2.0/grid/log/diag/tnslsnr/dtydb3/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.233)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.243)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "SMPDB" has 1 instance(s).
Instance "SMPDB1", status READY, has 1 handler(s) for this service...
Service "SYS$STRMADMIN.STREAMS_QUEUE.HRDB" has 1 instance(s).
Instance "hrdb1", status READY, has 1 handler(s) for this service...
Service "hrdb" has 1 instance(s).
Instance "hrdb1", status READY, has 1 handler(s) for this service...
Service "tyolap" has 1 instance(s).
Instance "tyolap1", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@dtydb3 trace]$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 04-JAN-2013 17:18:40
Service "tyolap" has 1 instance(s).
Instance "tyolap1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:444 state:blocked
LOCAL SERVER
The command completed successfully
此时业务也已不能正常连接
[grid@dtydb3 trace]$ tail -f listener.log
TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
Linux Error: 32: Broken pipe
04-JAN-2013 17:15:24 * (CONNECT_DATA=(SID=tyolap1)(CID=(PROGRAM=)(HOST=__jdbc__)(USER=))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.4.125.56)(PORT=63947)) * establish * tyolap1 * 12518
TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
Linux Error: 32: Broken pipe
3,由于刚修改过相关目录的权限,因此怀疑目录权限有问题,翻看操作日志,做了以下类似的操作,listener日志的权限被修改导致不能正确登录
chmod 655 /oracle/app/oracle/diag/rdbms/tyolap
chmod 644 listener.log
同时启动重启数据库也报错,也确定了权限的问题
tyolap1>startup
ORA-48146: missing read, write, or exec permission on directory during ADR initialization [/oracle/app/oracle/diag/rdbms/tyolap/tyolap1] [0]
ORA-48188: user missing read, write, or exec permission on specified directory
Linux-x86_64 Error: 13: Permission denied
Additional information: 2
4,查看另一个节点,正确的权限应该是,修改权限太大意,比较安全的方法是使用chmod u+x
[oracle@dtydb4 ~]$ ls -l /oracle/app/oracle/diag/rdbms/tyolap
total 4
-rw-r----- 1 oracle asmadmin 0 Jan 11 2012 i_1.mif
drwxr-xr-x 15 oracle asmadmin 4096 Jan 11 2012 tyolap2
5,修改权限后数据库恢复正常