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=(PROTOCOL=TCP)(HOST=NAME)(PORT=port)) scope=spile;
system altered.
可以查看一下我们修改的配置:
SQL> select name,network,paddr,status from v$dispatcher;
NAME
----
NETWORK
--------------------------------------------------------------------------------
PADDR STATUS
-------- ----------------
D000
(ADDRESS=(PROTOCOL=tcp)(HOST=gyc)(PORT=37090))
2C21A6EC WAIT
另外一个原因是监听不是本地的默认LISTENER监听修改成本地的监听。
SQL>alter system set local_listener='local_listener';
查看一下本地的监听:
SQL> show parameter local_listener;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=g
yc)(PORT=1522))
静态监听和动态监听:
[oracle@gyc ~]$ 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=(PROTOCOL=TCP)(HOST=gyc)(PORT=1521)))
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=(PROTOCOL=tcp)(HOST=gyc)(PORT=1521)))
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如下所示:
[oracle@gyc ~]$ 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=(PROTOCOL=TCP)(HOST=gyc)(PORT=1522)))
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=(PROTOCOL=tcp)(HOST=gyc)(PORT=1522)))
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
[oracle@gyc ~]$ 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=(PROTOCOL=TCP)(HOST=gyc)(PORT=1521)))
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会清理现场,释放相关的资源。 专用连接相当于一对一的连接,能够快速的响应用户的请求。当然,在连接的时候,首先要创建PGA(Program global area)。
共享链接:
采用共享连接可以有效的提高服务器资源的利用率,但是对一个分配器,只支持一种协议,每个分配器有自已的排队队列,在请求的任务完成后,由分配器将操作结果返回给相应的用户进程。但是共享连接的建立, 需要Oracle的监听进程、分配器、共享服务器进程才能共同完成一个连接的创建,所以连接的分配也需要一定的时间和资源。
如何选择这两种连接方式:
在理想的情况下,对于长事务或大事务,使用专用连接,可以有效的提高系统的性能,减少用户等待和事务的排队,提高系统的利用率。对于超短事务和短事务、小事务,使用共享连接方式,可以在资源与效率之间达到一种平稀。比如对于OLTP 系统,使用专用连接,而对于网站等,可以使用共享连接。