Oracle TNS 问题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2736377/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 20:32:02  来源:igfitidea点击:

Oracle TNS problems?

databaseoraclelistener

提问by persistence

I have an error ? My pl/Sql Developer says my oracle database cannot find the service descriptor But when I Do a check the listener I get this error.

我有错误?我的 pl/Sql 开发人员说我的 oracle 数据库找不到服务描述符但是当我检查监听器时我收到这个错误。

LSNRCTL> start
Starting tnslsnr: please wait...

Service OracleOraDb10g_home1TNSListener already running.
TNS-12560: TNS:protocol adapter error
 TNS-00530: Protocol adapter error



LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   32-bit Windows Error: 61: Unknown error

the content of my listener.ora is

我的 listener.ora 的内容是

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = Oracle10g)
      (ORACLE_HOME = D:\oracle\product.2.0\db_1)
      (SID_NAME = ORCL)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
  )

and the tnsnames.ora content is this

和 tnsnames.ora 内容是这个

# tnsnames.ora Network Configuration File: D:\oracle\product.2.0\db_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.

VMOBILE =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

VMOBILEMASTER =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = SHARED)
      (SERVICE_NAME = ORCL)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

Please I have a deadline for these evening. Please help.

请给我一个今晚的最后期限。请帮忙。

回答by APC

This is probably a configuration issue, which means it is difficult for us to solve remotely. The two things you need to check are

这很可能是配置问题,这意味着我们很难远程解决。您需要检查的两件事是

  1. The entries in your LISTENER.ORAfile match your TNSNAMES.ORAfile
  2. The information in your hostsfile is correct.
  1. 在你的条目LISTENER.ORA文件匹配您的TNSNAMES.ORA文件
  2. hosts文件中的信息是正确的。

Is this a local or a remote database you're attempting to connect to?

这是您尝试连接的本地数据库还是远程数据库?

edit

编辑

The hosts file (in a windows environment) is in somewhere like

主机文件(在 Windows 环境中)位于类似

C:\WINDOWS\system32\drivers\etc

Obviously it depends on how your environment is set up (different drive letter or whatever).

显然,这取决于您的环境是如何设置的(不同的驱动器号或其他)。

edit

编辑

You need the GLOBAL_DBNAMEin the listener file to match the SERVICE_NAMEin the tnsnsames file i.e. ORCL

您需要GLOBAL_DBNAME在侦听器文件中匹配SERVICE_NAMEtnsnames 文件中的 ,即 ORCL

回答by René Nyffenegger

The error is probably in the listener.orafile. Try replacing localhostin the line reading (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))with the name OR the ip number of the server where the listener is running on.

错误可能在listener.ora文件中。尝试用名称或运行侦听器的服务器的 IP 号替换localhost读取的行(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

回答by Gary Myers

I'd replace localhost with whatever ipconfig tells you is the IP address you are using.

我会将 localhost 替换为 ipconfig 告诉您的是您正在使用的 IP 地址的任何内容。

回答by novog

Unfortunately, this error can happen in a variety of cases.

不幸的是,此错误可能在多种情况下发生。

  1. The Oracle database service (OracleServiceXE or whatever edition you are using) is not actually running.
  2. The user was trying to run the TNSListener service under a non-administrator account, preventing it from registering the associated Windows service.
  3. There was a conflict due to more than one ORACLE_HOME on the machine.
  4. There is nothing wrong with the service or configuration settings, but the TNSListener service won't start successfully until the Windows server has been restarted.
  1. Oracle 数据库服务(OracleServiceXE 或您使用的任何版本)实际上并未运行。
  2. 用户试图在非管理员帐户下运行 TNSListener 服务,阻止它注册关联的 Windows 服务。
  3. 由于机器上有多个 ORACLE_HOME 发生冲突。
  4. 服务或配置设置没有任何问题,但在重新启动 Windows 服务器之前,TNSListener 服务不会成功启动。

回答by Nashev

I've solved this error message today by running LSNRCTL startfrom cmd.exe, started "as Administrator".

我今天通过从 cmd.exe运行LSNRCTL start解决了这个错误消息,“以管理员身份”启动。

I have 'localhost' server in listener.ora and in tnsnames.ora. Also i have SQLNET.AUTHENTICATION_SERVICES = (NONE) in sql.ini

我在 listener.ora 和 tnsnames.ora 中有“localhost”服务器。我也在 sql.ini 中有 SQLNET.AUTHENTICATION_SERVICES = (NONE)

Before I go trying use LSNRCTL.EXE, I haven't listener servise in windows services list. LSNRCTL startcommand from administrator's cmd make it for me.

在我尝试使用 LSNRCTL.EXE 之前,我还没有在 Windows 服务列表中监听服务。来自管理员 cmd 的LSNRCTL start命令为我制作。