References: http://www.itpub.net/thread-1714191-1-1.html
Oracleh has two server modes: shared mode and dedicated mode.
In Dedicated mode, the database creates a service process for each connection request sent by the client to complete the response. In shared mode, oracle will first establish a certain number of service processes, and the requests sent from the client will first be sent to the dispatcher, that is, the scheduler, and then the dispatcher will be responsible for the service process's busy schedule, the request is selectively delivered to a specific service process for response. After the shared service process responds, the response result is sent to the dispatcher, which then delivers the response to the client. In this process, two queues are involved, namely the Request queue and response queue. Both queues are located in the SGA, and the session information of the shared connection is placed in the Large pool, therefore, SGA is used more.
Advantages and disadvantages of using shared mode and dedicated mode.
Dedicated mode is used. Because a dedicated process is created for each connection request to respond, the response speed is faster than that of the shared mode. However, dedicate mode must create a dedicated PGA for each request, therefore, the demand for memory is higher. However, in the production environment, most of them use dedicated mode. The dedicated mode is also the default mode of oracle.
Using shared mode can effectively reduce the number of system processes and can be used in environments with a large memory limit. However, because shared mode must use the dispatcher program between client requests and server responses, it is more likely to cause congestion or deadlock, it may also be because a request occupies service time for a long time, resulting in a long wait for other requests. In addition, the shared mode is not easy to implement trace. In the production environment, most of them do not apply to shared mode, but use middleware software to achieve similar requirements.
View the server mode of the current system
Show parameter shared
First, shared_servers displays the number of shared service processes enabled when the system is started. If this parameter is greater than 0, the sharing mode is enabled. You do not need to set this parameter too large to increase the startup time, oracle automatically adjusts the number of shared service processes based on the load. This value is only the initial value at startup.
The Max_shared_servers parameter sets the maximum number of shared service processes.
Show parameter dispatcher
Only enabling shared_server does not actually enable the sharing mode. You also need to set dispatchers. The content of Dispatchers is like '(protocol = tcp) (service = jf01) (dispatchers = 3 )'. The protocol indicates the protocol type, the service indicates the service name to enable the sharing mode, and the dispatchers indicates the number of initial scheduling processes.
Max_dispatchers is the maximum number of scheduling processes.
In shared mode, the corresponding background processes start with "S" and "D", start with "S" as the service process, and start with "D" as the scheduling process, such as S000, S001, d000, D001 and so on. Select pname from v $ process.
Enable Shared Mode
The Dedicated mode is the default mode of oracle, and the shared mode is not recommended for oracle.
Enable sharing
Alter system set shared_servers = 2;
Set this parameter to be greater than 0
Alter system set dispatcher = '(protocol = tcp) (service = jf01) (dispatchers = 3 )';
Set the service to enable the sharing mode.
In addition, you need to change it in the tnsnames. ora file of the client under the instance resolution to use the Shared Mode connection.
(SERVER = SHARED) in CONNECT_DATA.
Only in this way can the client initiate a request to establish a shared connection. If the sharing mode is not enabled on the server at this time, the following error occurs:
ORA-12520 TNS: Listener count not find available handler for requested type of the server.
Disable Sharing Mode
Alter system set shared_server = 0;
Alter system set dispatcher = '';
In this way, you can.
View information about the current session
Select server from v $ session;
Related View
V $ shaed_server
V $ dispatcher
V $ circuit