近两天,在虚拟机的fedora12上安装了oracle11gR2服务器,监听和数据库实例(ORCL)都已经启动成功了。问题是:用root或oracle通过sqlplus scott/scott@orcl都能成功登录本机的数据库,但是以普通用户(zcm)登录就是失败。具体登录过程如下:[zcm@checkbill #35]$su oracle
密码:
[oracle@checkbill #1]$sqlplus scott/scott@orclSQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 28 10:47:15 2011Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@checkbill #2]$exit
exit
[zcm@checkbill #36]$su root
密码:
[root@checkbill #1]#sqlplus scott/scott@orclSQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 28 10:47:38 2011Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[root@checkbill #2]#exit
exit
[zcm@checkbill #37]$sqlplus scott/scott@orclSQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 28 10:47:50 2011Copyright (c) 1982, 2009, Oracle.  All rights reserved.ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name: 
--------------------------------------------------------------------------------------------
另外我在fedora上的tnsnames.ora中配置了本机windows中的oracle10服务器和远程linux上的oracle9服务器,还是同样的问题(用root或oracle可以成功登录,但是用zcm就是登录不成功,错误提示是一样的)。而且在windows中用sqlplus登录fedora中的oracle11g失败,提示为:ORA-12560: TNS: 协议适配器错误。登录远程linux中的oracle9能成功。
求各位大神帮忙。我在网上搜索过:ORA-12560: TNS: 协议适配器错误,多数答案都是在windows中访问本机的oracle失败,然后提供了解决方案,但却找不到与我同样问题的答案。另外,我申明,我fedora中的tnsnames.ora中没有特殊的不可见字符或实例名前带上了空格等,已经检查过了。

解决方案 »

  1.   

    检查过了,应该是正确的。
    否则,为什么用root或oracle就能登录成功呢。tnsnames.ora内容:1 # tnsnames.ora Network Configuration File: /opt/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
         2 # Generated by Oracle configuration tools.
           
         3 LISTENER_ORCL =
         4   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
           
           
         5 ORCL =
         6   (DESCRIPTION =
         7     (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
         8     (CONNECT_DATA =
         9       (SERVER = DEDICATED)
        10       (SERVICE_NAME = orcl)
        11     )
        12   )
           
        13 orcl83 =
        14   (DESCRIPTION =
        15     (ADDRESS_LIST =
        16       (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.25.83)(PORT = 1521))
        17     )
        18     (CONNECT_DATA =
        19       (SERVICE_NAME = orcl)
        20     )
        21   )
           
        22 ORAS =
        23   (DESCRIPTION =
        24     (ADDRESS_LIST =
        25       (ADDRESS = (PROTOCOL = TCP)(HOST = 115.238.110.119)(PORT = 5123))
        26     )
        27     (CONNECT_DATA =
        28       (SERVICE_NAME = ORAS)
        29     )
        30   )
           
        31 ORA10 =
        32   (DESCRIPTION =
        33     (ADDRESS_LIST =
        34       (ADDRESS = (PROTOCOL = TCP)(HOST = 115.238.110.119)(PORT = 15023))
        35     )
        36     (CONNECT_DATA =
        37       (SERVICE_NAME = ORA10)
        38     )
        39   )
      

  2.   

    另外补充下,我刚开始怀疑可能是权限的问题。后来把zcm用户添加到oinstall和dba组下,重启监听和数据库实例后,还是同样的问题!
      

  3.   

    chmod o+r $ORACLE_HOME/network/admin/tnsnames.ora给 tnsnames.ora 其他用户可读权限
      

  4.   

    ls -lrt $ORACLE_HOME/bin/oracle把你这个权限查出来的情况贴出来看看
      

  5.   

    你看看查询出来的权限里有没有-rws 带s的权限,没有的话就执行
    chmod 6755 $ORACLE_HOME/bin/oracle
    然后再用普通用户试试
      

  6.   

    也不知道怎么的,后来普通用户也可以登录了。可能是修改了配置,没有重启机器的原因吧,自己都搞不清楚。另外,其他windows的机器无法登录fedora中的oracle,主要是因为fedora中开了防火墙(我把它和selinux搞混了),以及oracle监听器没有配置好(没有监听这个oracle实例)造成的!