http://blog.csdn.net/dream19881003/article/details/6666471
http://blog.csdn.net/tianlesoftware/article/details/6617827
最近在使用以前服务器的listner的时候出现“不能识别当前的链接”找了很多资料很少无奈后来静下来想了一下客户端坚挺不到oracle说明是服务器dispatcher的问题
查看了一下dispatcher的参数
SQL>show parameter dispachers;
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ dispatchers string max_dispatchers integer
没有内容添加一下服务器的配置
SQL>alter system set dispatchers(ADDRESS(PROTOCOLTCP)(HOSTNAME)(PORTport)) scopespile;
system altered.
可以查看一下我们修改的配置
SQL> select name,network,paddr,status from v$dispatcher;
NAME ---- NETWORK -------------------------------------------------------------------------------- PADDR STATUS -------- ---------------- D000 (ADDRESS(PROTOCOLtcp)(HOSTgyc)(PORT37090)) 2C21A6EC WAIT
另外一个原因是监听不是本地的默认LISTENER监听修改成本地的监听。
SQL>alter system set local_listenerlocal_listener;
查看一下本地的监听
SQL> show parameter local_listener;
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ local_listener string (ADDRESS(PROTOCOLTCP)(HOSTg yc)(PORT1522))
静态监听和动态监听
[oraclegyc ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-AUG-2011 22:07:39
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION(ADDRESS(PROTOCOLTCP)(HOSTgyc)(PORT1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production Start Date 04-AUG-2011 20:48:53 Uptime 0 days 1 hr. 18 min. 46 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /opt/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File /opt/oracle/product/10.2.0/db_1/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION(ADDRESS(PROTOCOLtcp)(HOSTgyc)(PORT1521))) Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "orcl" has 1 instance(s). Instance "orcl", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
静态监听显示的是“uknow“ 动态的显示的ready如下所示
[oraclegyc ~]$ lsnrctl status listener1
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-AUG-2011 22:08:31
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION(ADDRESS(PROTOCOLTCP)(HOSTgyc)(PORT1522))) STATUS of the LISTENER ------------------------ Alias listener1 Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production Start Date 04-AUG-2011 20:59:02 Uptime 0 days 1 hr. 9 min. 28 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /opt/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File /opt/oracle/product/10.2.0/db_1/network/log/listener1.log Listening Endpoints Summary... (DESCRIPTION(ADDRESS(PROTOCOLtcp)(HOSTgyc)(PORT1522))) Services Summary... Service "orcl" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orclXDB" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orcl_XPT" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... The command completed successfully
静态监听的listener.ora的内容如下
SID_LIST_LISTENER (SID_LIST (SID_DESC (SID_NAME PLSExtProc) (ORACLE_HOME /opt/oracle/product/10.2.0/db_1) (PROGRAM extproc) ) (SID_DESC (GLOBAL_DBNAME orcl) (ORACLE_HOME /opt/oracle/product/10.2.0/db_1) (SID_NAME orcl) ) )
LISTENER (DESCRIPTION (ADDRESS (PROTOCOL TCP)(HOST gyc)(PORT 1521)) )
动态的如下
LISTENER1 (DESCRIPTION (ADDRESS (PROTOCOL TCP)(HOST gyc)(PORT 1522)) )
SID_LIST_LISTENER (SID_LIST (SID_DESC (SID_NAME PLSExtProc) (ORACLE_HOME /opt/oracle/product/10.2.0/db_1) (PROGRAM extproc) ) (SID_DESC (GLOBAL_DBNAME orcl) (ORACLE_HOME /opt/oracle/product/10.2.0/db_1) (SID_NAME orcl) ) )
关于service
[oraclegyc ~]$ lsnrctl service
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-AUG-2011 22:09:44
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION(ADDRESS(PROTOCOLTCP)(HOSTgyc)(PORT1521))) Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 LOCAL SERVER Service "orcl" has 1 instance(s). Instance "orcl", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 LOCAL SERVER The command completed successfully
上面显示的是两个静态链接服务名是orcl,实例名也是orcl 显示的是静态监听
"DEDICATED" established:0 refused:0 LOCAL SERVER The command completed successfully
表示专有链接链接为0拒绝为0
专有链接
每一个连接到数据库服务器的客户端请求服务器会和客户端之间建立起连接这个连接用于专门处理该客户端的所有请求直到用户主动断开连接或网络出现中断。在连接处于空闲时后台进程PMON会每隔一段时间就会测试用户连接状况如果连接已断开PMON会清理现场释放相关的资源。 专用连接相当于一对一的连接能够快速的响应用户的请求。当然在连接的时候首先要创建PGAProgram global area。
共享链接
采用共享连接可以有效的提高服务器资源的利用率但是对一个分配器只支持一种协议每个分配器有自已的排队队列在请求的任务完成后由分配器将操作结果返回给相应的用户进程。但是共享连接的建立 需要Oracle的监听进程、分配器、共享服务器进程才能共同完成一个连接的创建所以连接的分配也需要一定的时间和资源。
如何选择这两种连接方式
在理想的情况下对于长事务或大事务使用专用连接可以有效的提高系统的性能减少用户等待和事务的排队提高系统的利用率。对于超短事务和短事务、小事务使用共享连接方式可以在资源与效率之间达到一种平稀。比如对于OLTP 系统使用专用连接而对于网站等可以使用共享连接。
转:https://blog.51cto.com/garlics/1109192
【文章原创作者:美国服务器 https://www.68idc.cn处的文章,转载请说明出处】