## ORACLE参数max_shared_servers空值与零的区别

2016-08-31 22:16 潇湘隐者 阅读(...) 评论(...) 编辑 收藏

ORACLE数据库中的参数max_shared_servers，这是一个DBA很熟悉的参数，但是这个参数max_shared_servers为空值与为0有区别吗？这个细节可能很多人都没有注意过。如下所示：


SQL> show parameter max_shared_servers

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
max_shared_servers                   integer
SQL>

SQL> show parameter shared

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
max_shared_servers                   integer
shared_memory_address                integer     0
shared_pool_reserved_size            big integer 23488102
shared_pool_size                     big integer 0
shared_server_sessions               integer     100
shared_servers                       integer     1
SQL>

SQL> alter system set shared_servers=1 scope=both;

System altered.

SQL>

[oracle@DB-Server trace]$ps -ef | grep ora_s00 | grep -v grep oracle 6824 1 0 15:35 ? 00:00:02 ora_s000_gsp [oracle@DB-Server trace]$

UPDATE TEST SET NAME='Kerry' WHERE ID= 1001;

SQL> alter system set max_shared_servers=0 scope=both;

System altered.

SQL> !
[oracle@DB-Server ~]$ps -ef | grep ora_s00 | grep -v grep oracle 6824 1 0 15:35 ? 00:00:02 ora_s000_gsp [oracle@DB-Server ~]$

[oracle@DB-Server ~]$ps -ef | grep ora_s00 | grep -v grep oracle 8396 1 0 17:21 ? 00:00:00 ora_s000_gsp [oracle@DB-Server ~]$ ps -ef | grep ora_s00 | grep -v grep
oracle    8396     1  0 17:21 ?        00:00:00 ora_s000_gsp
[oracle@DB-Server ~]$ps -ef | grep ora_s00 | grep -v grep oracle 8396 1 0 17:21 ? 00:00:00 ora_s000_gsp [oracle@DB-Server ~]$ ps -ef | grep ora_s00 | grep -v grep
oracle    8396     1  0 17:21 ?        00:00:00 ora_s000_gsp
[oracle@DB-Server ~]\$

UPDATE TEST SET NAME='Kerry' WHERE ID= 1001;

SQL> alter system reset "max_shared_servers" scope=spfile;

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

MAX_SHARED_SERVERS specifies the maximum number of shared server processes allowed to be running simultaneously. Setting this parameter enables you to reserve process slots for other processes, such as dedicated servers.

When you want to reduce the range of shared servers, you can reduce MAX_SHARED_SERVERS before reducing SHARED_SERVERS. If MAX_SHARED_SERVERS is lower than SHARED_SERVERS, then the number of shared servers will not vary but will remain at the constant level specified by SHARED_SERVERS. If MAX_SHARED_SERVERS is not specified, then a shared server process may be spawned as long as the number of free process slots is greater than 1 / 8 the maximum number of processes, or 2 if PROCESSES is less than 24.

• SHARED_SERVERS: 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.

• MAX_SHARED_SERVERS: Specifies the maximum number of shared servers that can run simultaneously.

• SHARED_SERVER_SESSIONS: 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.

• DISPATCHERS: Configures dispatcher processes in the shared server architecture.

• MAX_DISPATCHERS: Specifies the maximum number of dispatcher processes that can run simultaneously. 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: Specifies the total number of virtual circuits that are available for inbound and outbound network sessions.