今天公司的测试数据库出现了故障,查找下来发现与使用的Shared mode有关。不过一时间竟然想不起来shared mode和dedicated mode是怎么配置的了(鄙视下自己)。解决问题后,特此整理了下这个基础知识,引以为戒。
Shared Server的配置
和Shared Server相关的参数主要有两个:shared_server和dispatchers。后一个参数用来设置分发器,可以针对不同的协议设置分发器,比如这样
DISPATCHERS = “(PRO=TCP)(DIS=3)(PRO=IPC)(DIS=2)”
复杂一点的,带有连接池的
DISPATCHERS="(PROTOCOL=tcp)(DISPATCHERS=1)(POOL=on)(TICK=1)(CONNECTIONS=500)(SESSIONS=1000)"
Shared_server用来定义系统启动时启动的Shared server数量,如果是0,就取消了Shared mode。
除了这两个主要的参数,还有几个其他参数。
MAX_DISPATCHERS:设置最大的调度器数
SHARED_SERVER_SESSIONS:设置SHARED SERVER的最大session数。
MAX_SHARED_SERVERS:设置最大的SHARED_SERVER数。如果未给此参数附值,那么SHARED_SERVER数库无限制。
检查系统是否正在使用Shared mode
在V$session.server字段,可以看出是否使用了Shared mode模式。Dedicated、Shared这两个值的含义毫无歧意,如果是None,也是Shared mode,只是这个会话当前不活跃。
select server,program,username,status from v$session
order by program
DEDICATED oracle@devdb (CJQ0) ACTIVE
DEDICATED oracle@devdb (CKPT) ACTIVE
DEDICATED oracle@devdb (DBW0) ACTIVE
DEDICATED oracle@devdb (LGWR) ACTIVE
DEDICATED oracle@devdb (MMAN) ACTIVE
DEDICATED oracle@devdb (MMNL) ACTIVE
DEDICATED oracle@devdb (MMON) ACTIVE
DEDICATED oracle@devdb (PMON) ACTIVE
DEDICATED oracle@devdb (PSP0) ACTIVE
DEDICATED oracle@devdb (QMNC) ACTIVE
DEDICATED oracle@devdb (RECO) ACTIVE
DEDICATED oracle@devdb (SMON) ACTIVE
NONE oracle@devdb1 (S000) ZHANGXINCHEN
NONE plsqldev.exe DEVSTATION3 ACTIVE
NONE plsqldev.exe DEVSTATION3 INACTIVE
NONE plsqldev.exe ZHANGXINCHENG INACTI
NONE plsqldev.exe ZHANGXINCHENG INACTI
NONE plsqldev.exe DEVSTATION3 INACTIVE
NONE plsqldev.exe DEVSTATION3 INACTIVE
说明:Background process ,以及通过本地连接进来的,只能是DEDICATED,比如sqlplus 本地登陆的。
在本地建立了一个tns,使用DB缺省的连接方式,然后连接到数据库后,察看这个连接:
select s.server,s.username,s.program,s.status,p.PROGRAM from v$session s,v$process p
where s.paddr=p.addr
and s.USERNAME='SYSTEM'
SERVER USERNAME PROGRAM STATUS PROGRAM
NONE SYSTEM plsqldev.exe INACTIVE oracle@devdb (D000)
SHARED SYSTEM plsqldev.exe ACTIVE oracle@devdb (S000)
关闭Shared mode
alter system set shared_server=0 scope=both;
重启系统后观察,全部变成了专有连接。
http://fusnow.itpub.net/post/681/214188
http://airlgc.blog.违规广告.com/161810/36188
http://www.oracle-training.cc/10g_304.htm
Oracle 10g Simplified Shared Server Configuration
In Oracle 10g, you no longer need to set as many initialization parameters for shared server environments. In fact, you only need to set one parameter if you are using TCP/IP as your communication protocol, and the rest of the settings are now managed internally.
Shared Server Initialization Parameters
The following initialization parameters in Oracle 10g control shared server operation:
shared_servers – This parameter specifies the initial number of shared servers to start and the minimum number of shared servers to keep. This is the only required parameter for using shared servers. Setting this to a non-zero value automatically specifies shared server.
max_shared_servers – This parameter specifies the maximum number of shared servers that can run simultaneously. Once shared server is initialized, the Oracle system will increase the number of shared servers up to this value as needed.
shared_server_sessions -- This parameter specifies the total number of shared server user sessions that can run simultaneously. Setting this parameter enables you to reserve user sessions for dedicated servers. For example, if the sessions parameter is set at 1000 and you set shared_server_sessions to 900, then 100 dedicated sessions are available, even if all 900 shared sessions are in use.
dispatchers – This parameter configures dispatcher processes in the shared server architecture. One dispatcher is always configured by default for the TCP/IP protocol, even if the parameter is not explicitly specified.
max_dispatchers – This parameter specifies the maximum number of dispatcher processes that can run simultaneously. According to the Oracle 10g manuals, this parameter can be ignored for now. It will only be useful in a future release when the number of dispatchers is auto-tuned, according to the number of concurrent connections.
circuits – This parameter specifies the total number of virtual circuits that are available for inbound and outbound network sessions.
Even though there are six initialization parameters, shared server is enabled by setting one parameter and is turned on if the shared_servers initialization parameter is set to a value greater than 0. This is all that is required. The other shared server initialization parameters do not need to be set. Because the shared server parameter requires at least one dispatcher to work, a dispatcher is brought up automatically even when no dispatcher has been configured.
Using SQL*Plus or OEM, the shared server features can be started dynamically by setting the shared_servers parameter to a nonzero value
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/75321/viewspace-619474/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/75321/viewspace-619474/