您的位置:首页 > 数据库 > Oracle

Oracle 的监听(动态监听和静态监听)

2015-11-04 19:38 507 查看
Oracle 的监听(动态监听和静态监听)

参考资料:

ora-12514:TNS:listener does not currently know of service requested in connect descriptor
http://blog.csdn.net/kingsonl/article/details/8062757
问题描述:

客户端1上的

C:\Oracle\ora92\network\ADMIN\tnsnames.ora

#ocptwo153

OCPTWO153 =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ocptwo)

)

)

客户端2上的

/u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora

#ocptwo153

OCPTWO153 =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ocptwo)

)

)

客户端1:

SQL> connect test01/密码@ocptwo153

ERROR:

ORA-12514: TNS: 监听进程不能解析在连接描述符中给出的 SERVICE_NAME

客户端2:

SQL> connect test01/密码@ocptwo153

ERROR:

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

descriptor

#查看oracle 服务端的listener

[oracle@localhost admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

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

(PROGRAM = extproc)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))

)

)

#新加的OCPTWO的监听,注意红色加粗的那一段

SID_LIST_OCPTWO =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

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

(PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBNAME = ocptwo)

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

(SID_NAME = ocptwo)


)

)

OCPTWO =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))

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

)

)

#启动监听

[oracle@localhost admin]$ lsnrctl start ocptwo

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 20-OCT-2015 01:49:30

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

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production

System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/ocptwo.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.153)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

STATUS of the LISTENER

------------------------

Alias ocptwo

Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date 20-OCT-2015 01:49:30

Uptime 0 days 0 hr. 0 min. 0 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/ocptwo.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.250)(PORT=1521)))

Services Summary...

Service "ORACLE" has 1 instance(s).

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

Service "PLSExtProc" has 1 instance(s).

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

The command completed successfully

#查看进程

[oracle@localhost admin]$ ps -ef|grep tnslsnr |grep -v grep

oracle 4819 1 0 01:49 ? 00:00:00 /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr ocptwo -inherit

客户端1:

SQL> connect test01/密码@ocptwo153

Connected.

客户端2:

SQL> connect test01/密码@ocptwo153

已连接。

//---------------------------------------------------------------------------//

客户端上的tnsnames.ora还有一种配法:

#oracle\product\10.2.0\client_1\network\admin\tnsnames.ora

ORCL =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl)

)

)

EXTPROC_CONNECTION_DATA =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

)

(CONNECT_DATA =

(SID = PLSExtProc)

(PRESENTATION = RO)

)

)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: