ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务(另一种情况)

时间:2022-11-18 22:42:03

1 listener.ora配置

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = test.oracle.com)

      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)

      (SID_NAME = test)

    )

  )

 

LISTENER =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.128.5)(PORT = 1521))

  )

 

注意: GLOBAL_DBNAME是写出完整的名称

2 tnsnames.ora配置

MYCENT =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.128.5)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVER = dedicated)

      (SERVICE_NAME = test)

    )

  )

3 侦听的服务

[oracle@cent4 admin]$ lsnrctl service

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-5 -2011 20:48:55

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.128.5)(PORT=1521)))

Services Summary...

Service "test.oracle.com" has 1 instance(s).

  Instance "test", status UNKNOWN, has 1 handler(s) for this service...

    Handler(s):

      "DEDICATED" established:0 refused:0

         LOCAL SERVER

注意: 服务是test.oracle.com,实例是test.

4 错误出现

[oracle@cent4 admin]$ sqlplus hr/hr@mycent

SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 5月 4 20:49:49 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

ERROR:

ORA-12514: TNS:listener does not currently know of service requested in connect

descriptor

Enter user-name:

5 原因分析

注意: 服务是test.oracle.com,实例是test.

而在tnsnames.ora中服务名是 test.

只要将tnsnames.ora中服务名是 test.oracle.com,问题即可解决.