oracle的共享server模式

时间:2023-01-04 03:40:49
设置共享服务模式的库,需要做下面的几步:
1 为共享server初始化参数
2启用共享server
3配置dispatchers
4监控共享server


1:下面几个参数控制了共享servre的操作
shared_servers:指定了初始共享server数量及最小保持的共享server数量,这个事是唯一要求的参数。
max_shared_servers:指定了同时运行的最大的数量。
shared_server_sessions:指定了用户会话能同时运行的共享server数量。
dispatchers:配置dispatcher的数量。
max_dispatchers最大值。
circuits:指定虚拟circuits,这个占用共享内存。


2启用共享server
设置shared_servers大于0,就启用了共享server,其他的参数不必设置,因为共享server需要至少一个dispatcher来工作,如果dispatcher没有被配置,会有1个dispatcher被启动起来。
ALTER SYSTEM SET SHARED_SERVERS = 5;

决定shared_servers的数量
数据库启动后,能基于现有共享server的繁忙程度及请求队列的长度动态的决定共享server的数量。
在一个典型的系统中,共享server的比率稳定在10个连接对应一个共享server。


3配置dispatcher


Number of dispatchers =CEIL ( max. concurrent sessions / connections for each dispatcher )


CEIL returns the result roundest up to the next whole integer.
 
For example, assume a system that can support 970 connections for each process, and that has:
A maximum of 4000 sessions concurrently connected through TCP/IP and
 A maximum of 2,500 sessions concurrently connected through TCP/IP with SSL
 
The DISPATCHERS attribute for TCP/IP should be set to a minimum of five dispatchers (4000 / 970), and for TCP/IP with SSL three dispatchers (2500 / 970)

alter system set DISPATCHERS='(PROT=tcp)(DISP=5)', '(PROT-tcps)(DISP=3)';
alter system set DISPATCHERS='(PROTOCOL=TCP)(DISPATCHERS=2)'


4监控


在实例中可以控制dispatcher的进程数量,不像共享server,dispatcher不会自动改变。监控dispatcher,可以使用下面的视图


The following views are useful for obtaining information about your shared server configuration and for monitoring performance.

View Description
V$DISPATCHER Provides information on the dispatcher processes, including name, network address, status, various usage statistics, and index number.
V$DISPATCHER_CONFIG Provides configuration information about the dispatchers.
V$DISPATCHER_RATE Provides rate statistics for the dispatcher processes.
V$QUEUE Contains information on the shared server message queues.
V$SHARED_SERVER Contains information on the shared servers.
V$CIRCUIT Contains information about virtual circuits, which are user connections to the database through dispatchers and servers.
V$SHARED_SERVER_MONITOR Contains information for tuning shared server.
V$SGA Contains size information about various system global area (SGA) groups. May be useful when tuning shared server.
V$SGASTAT Contains detailed statistical information about the SGA, useful for tuning.
V$SHARED_POOL_RESERVED Lists statistics to help tune the reserved pool and space within the shared pool.






5关闭指定的dispatcher


1 select name,network from v$dispatcher;


2 alter system shutdown immediate 'D002';


6连接共享服务模式库

a 配置tnsname.ora

TEST =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.101)(PORT = 1527))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)(server=shared)
    )
  )


b通过该服务名登录

sqlplus system/888@test


c查看

[oracle@ocm1 admin]$ lsnrctl service lsnr1


LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 20-AUG-2014 07:33:53


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


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.101)(PORT=1527))
Services Summary...
Service "orcl" has 2 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:1 refused:0
         LOCAL SERVER
  Instance "orcl", status READY, has 3 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:6 refused:0 state:ready
         LOCAL SERVER
      "D001" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ocm1, pid: 6578>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=34029))
      "D000" established:1 refused:0 current:1 max:1022 state:ready
         DISPATCHER <machine: ocm1, pid: 6576>

         (ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=34028))
Service "orcl_XPT" has 1 instance(s).
  Instance "orcl", status READY, has 3 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:6 refused:0 state:ready
         LOCAL SERVER
      "D001" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ocm1, pid: 6578>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=34029))
      "D000" established:1 refused:0 current:1 max:1022 state:ready
         DISPATCHER <machine: ocm1, pid: 6576>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=34028))
The command completed successfully


翻译自Oracle® Database Administrator's Guide