Home Database Mysql Tutorial TNS-03505问题解决总结

TNS-03505问题解决总结

Jun 07, 2016 pm 05:23 PM
database

最近部署项目,Linux系统使用非oracle用户测试(比如test)tnsping orcl出现如下提示信息:TNS-03505: Failed to resolve name

最近部署项目,,Linux系统使用非Oracle用户测试(比如test)tnsping orcl出现如下提示信息:
 
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 04-DEC-2012 14:29:28
 
Copyright (c) 1997, 2009, Oracle.  All rights reserved.
 
Used parameter files:
 
/opt/oracle/product/11g/network/admin/sqlnet.ora
 
TNS-03505: Failed to resolve name
 
乍一看,问题出现原因清楚明了。就是orcl服务名无法解析。但是我在本局域网使用其它windows系统中的pl/sql可以连接。
 
因为对Linux系统认知甚少,所以一头雾水。去网搜一下很多,大约有这么几种解决方案:
 
一是文件配置错误;
 
二是sqlnet.ora文件中NAMES.DIRECTORY_PATH设置问题;
 
三是lsnrctl status 监听错误或者sqlplus版本问题。 
 
第一种情况意思就是说在tnsnames.ora这个文件中我配置的orcl有问题,大部人说前面不能有空格,我的本来就没有;再就是listener.ora有一个标准的写法,如下:
 
SID_LIST_LISTENER =
 
  (SID_LIST =
 
    (SID_DESC =
 
      (SID_NAME = PLSExtProc)
 
      (ORACLE_HOME = /oracle/product/10.2.0/db_1)
 
      (PROGRAM = extproc)
 
    )
 
    (SID_DESC =
 
      (GLOBAL_DBNAME = orcl)
 
      (ORACLE_HOME = /oracle/product/10.2.0/db_1)
 
      (SID_NAME = orcl)
 
    )
 
  )
 
LISTENER =
 
  (DESCRIPTION_LIST =
 
    (DESCRIPTION =
 
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
 
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
 
)
 
)
 
第二种情况说的是通过客户端访问数据库服务器顺序。我也是从这个帖子发现我的问题的,我的linux用户test没有访问tnsname.ora这个文件的权限。
 
第三种情况说的是监听服务没起来。这个很容易就能查别,使用lsnrctl status即可知道。

通过解决这么一个问题,我总结一下思路:

首先:查询监听状态。因为我的可以通过其它客户端访问,所以不会是监听的问题。
 
其次:使用oracle用户,测试tnsping orcl。一般情况下肯定通。非oracle用户并且不属于oracle用户所属组的查看是否有权限。没有权限使用: chmod o+r tnsname.ora即可。
 
最后:版本兼容性的问题。

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

How does Go language implement the addition, deletion, modification and query operations of the database?

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

Detailed tutorial on establishing a database connection using MySQLi in PHP

Comparison of similarities and differences between MySQL and PL/SQL Comparison of similarities and differences between MySQL and PL/SQL Mar 16, 2024 am 11:15 AM

Comparison of similarities and differences between MySQL and PL/SQL

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

How does Hibernate implement polymorphic mapping?

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos

Analysis of the basic principles of MySQL database management system Analysis of the basic principles of MySQL database management system Mar 25, 2024 pm 12:42 PM

Analysis of the basic principles of MySQL database management system

An in-depth analysis of how HTML reads the database An in-depth analysis of how HTML reads the database Apr 09, 2024 pm 12:36 PM

An in-depth analysis of how HTML reads the database

Tips and practices for handling Chinese garbled characters in databases with PHP Tips and practices for handling Chinese garbled characters in databases with PHP Mar 27, 2024 pm 05:21 PM

Tips and practices for handling Chinese garbled characters in databases with PHP

See all articles