ITPub博客

首页 > 数据库 > Oracle > ORA-12547: TNS:lost contact之oracle执行文件权限问题

ORA-12547: TNS:lost contact之oracle执行文件权限问题

原创 Oracle 作者:TaihangMeng 时间:2016-06-22 23:12:16 0 删除 编辑

1、报错信息:
  1. ERROR:
  2. ORA-12547: TNS:lost contact
2、产生该报错的情形

非oracle用户使用sqlplus username/password 后面不使用tnsname.ora 文件中连接字符串的名称时报错:ORA-12547: TNS:lost contact

3、解决方法:
第一步:查看$ORACLE_HOME/bin/oracle的权限:

  1. ll $ORACLE_HOME/bin/oracle
  2. -rwxr-x--x 1 oracle oinstall 239626731 Apr  6 14:22 /oracle/product/11.2.0/bin/oracle

第二步:修改oracle的权限为6751默认权限:

  1. chmod 6751 $ORACLE_HOME/bin/oracle
  2. -rwsr-s--x 1 oracle oinstall 239626731 Apr  6 14:22 /oracle/product/11.2.0/bin/oracle
参考网址:http://www.uncletoo.com/html/oracle/295.html

实验模拟:

1、以mth用户登录系统,使用DB 账号mth以下面的方式连接数据库。

  1. [mth@TaylonMeng ~]$ sqlplus mth/mth

  2. SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 22 22:40:23 2016

  3. Copyright (c) 1982, 2013, Oracle. All rights reserved.

  4. ERROR:
  5. ORA-12547: TNS:lost contact

  1. [mth@TaylonMeng ~]$ sqlplus mth/mth@MTH

  2. SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 22 22:43:52 2016

  3. Copyright (c) 1982, 2013, Oracle. All rights reserved.


  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  7. SQL> 
可以看到,使用sqlplus mth/mth@MTH 这种方式就可以连接,但是sqlplus mth/mth这种会报错。

2、查看$ORACLE_HOME/bin/oracle该执行文件的权限

  1. [oracle@TaylonMeng ~]$ ll $ORACLE_HOME/bin/oracle
  2. -rwxr-x--x 1 oracle oinstall 239626731 Mar 16 23:16 /oracle/product/11.2.0/bin/oracle
看到该执行文件的权限被修改了,导致非oracle账号在执行该文件时,无法获得oracle账号的权限,因此会报错。

3、修改$ORACLE_HOME/bin/oracle的权限为默认的6751.

  1. [oracle@TaylonMeng ~]$ chmod 6751 /oracle/product/11.2.0/bin/oracle
  2. [oracle@TaylonMeng ~]$ ll $ORACLE_HOME/bin/oracle
  3. -rwsr-s--x 1 oracle oinstall 239626731 Mar 16 23:16 /oracle/product/11.2.0/bin/oracle
-rwsr-s--x中的“s”,具有如下的限制和功能:
  • SUID 权限仅对二进制程序(binary program)有效;
  • 运行者对于该程序需要具有 x 的可运行权限;
  • 本权限仅在运行该程序的过程中有效 (run-time);
  • 运行者将具有该程序拥有者 (owner) 的权限。
  1. [mth@TaylonMeng ~]$ sqlplus mth/mth

  2. SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 22 23:07:27 2016

  3. Copyright (c) 1982, 2013, Oracle. All rights reserved.


  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  7. SQL>
权限修改后,再通过这种方式连接,就不会有报错了。




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30776559/viewspace-2120766/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-01-07

  • 博文量
    101
  • 访问量
    147090