SQL> show parameter max_shared_servers NAME TYPE VALUE------------------------------------ ----------- ------------------------------max_shared_servers integerSQL> SQL> show parameter shared NAME TYPE VALUE------------------------------------ ----------- ------------------------------hi_shared_memory_address integer 0max_shared_servers integershared_memory_address integer 0shared_pool_reserved_size big integer 23488102shared_pool_size big integer 0shared_server_sessions integer 100shared_servers integer 1SQL>
检查一下参数shared_servers, 这个参数不能为0,否则下面测试,连接数据库就会报“ORA-12520:TNS: 监听程序无法为请求的服务器类型找到可以用的处理程序”错误。如果shared_servers为0,将其设置为1(也请留意参数shared_server_sessions影响测试结果)
SQL> alter system set shared_servers=1 scope=both; System altered. SQL>
此时检查shared server process的数量,你会发现只有一个shared server 进程,如下所示
如果你每个会话都执行同一个UPDATE语句, 还会遇到下面错误,当然max_shared_servers为空值的情况是不会遇到这种情况的。
UPDATE TEST SET NAME='Kerry' WHERE ID= 1001;
可以使用下面SQL语句将max_shared_servers参数重置为空值。不过需要重启实例
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参数为空值的情况,其实官方文档已经给出了详细描述:
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.