Dedicated server and Shared Server in ORACLE connection mode

Source: Internet
Author: User
Tags dedicated server
1. There are two connection modes in ORACLE data. One is a dedicated server mode for a session to establish a connection, and the other is a shared server mode for multiple sessions to share a connection. In different scenarios, proper use can greatly improve application access efficiency and command execution efficiency. 2. Dedicated servers, as the name suggests, refer

1. There are two connection modes in ORACLE data. One is a dedicated server mode for a session to establish a connection, and the other is a shared server mode for multiple sessions to share a connection. In different scenarios, proper use can greatly improve application access efficiency and command execution efficiency. 2. Dedicated servers, as the name suggests, refer

1. Summary

There are two connection modes for ORACLE Data: one is the dedicated server mode for a session to establish a connection, and the other is the Shared Server Mode for multiple sessions to share a connection. In different scenarios, proper use can greatly improve application access efficiency and command execution efficiency.

2. Dedicated servers

A dedicated server, as its name implies, means that the server connection is only available to a single user and cannot be shared with other users. When a user requests a connection through a dedicated server, the server will create a connection process for the user to provide services.

When we connect to the database through a dedicated server, a dedicated process will be created to provide services:


Then, we use the pl/SQL developer user scott to establish two dedicated server connections with the instance and query the database instance process again:


It can be found that the instance has two more session processes, so that the instance allocates a special process for each session, and the session corresponds to the dedicated server one by one.

The diagram of the dedicated server is as follows:


When a user logs on, a process is always created to provide special services for the session. Each time a new session is created, the listener creates a new dedicated server to provide specialized services. Sessions correspond to dedicated servers one by one. Users' customer processes will communicate directly with specialized servers through some network channel to respond to the SQL and PL/SQL calls we have submitted.

3. Shared Server

A Shared Server can be understood as a connection pool with many sessions, but the number of available connections is fixed. Through resource scheduling, sessions can be dynamically managed to establish connections with instances, these connections are shared by all sessions, which can effectively reduce resource loads.

The principles of the Shared Server are as follows:


To share server processes, you need to establish a scheduling mechanism between the client process and the shared server to ensure the effectiveness of scheduling. The user initiates a connection request. After the listener receives the connection request, it selects one from the callable scheduler and returns the connection port and other information to the user. The scheduler waits on the corresponding port, the customer process will be connected to the scheduler. After connecting with the scheduler, transfer the user request to the SGA Request queue. The first idle Shared Server will receive the request and process it. After the process is completed, the Shared Server places the results in the response queue. The scheduler listens to the response queue in the same way. Once a result is found, the result is sent to the user.

4. Use Cases

The main differences between dedicated servers and shared servers:

The customer process does not directly communicate with the shared server, but can directly communicate with the dedicated server. There is also a scheduling mechanism between the customer process and the shared server.

Shared servers can allocate resources and balance loads better than dedicated servers. However, the scheduling mechanism consumes a certain amount of system resources and reduces the execution efficiency, therefore, you must use it with caution.

Dedicated server environment:

1. When the number of connected users is small, it does not exceed the limit of the sharing process, improving the connection efficiency.

2. In order to implement the data warehouse, the database must use a dedicated server, which is mandatory by oracle.

3. When the online transaction processing system meets the requirement that the number of user connections is greater than the number of shared processes, and the transaction processed is large, the dedicated service is more efficient than the Shared Server.

Shared Server Environment:

1. If you have a large number of connected users and a small number of transactions, the shared server can efficiently configure resource adjustment.

2. Considering the server memory, the Shared Server can be more efficient with more effective resources.

3. For example, Server Load balancer and other features require shared servers.

By default, dedicated servers are recommended for ORACLE, while shared servers provide the following advantages:

1. Reduce the number of operating system processes, reduce the resource consumption for context switching of the operating system, and improve efficiency.

2. effectively limit the concurrency, that is, the system consumption is now within a reasonable range.

The two modes have advantages and disadvantages and need to be used as needed.

5. Server Mode settings

5.1 dedicated servers

Dedicated server, which is the default ORACLE startup option, does not require additional settings.

5.2 Shared Server

1. Parameter: SHARED_SERVERS

The value of SHARED_SERVERS is greater than 0, indicating that the sharing mode is enabled.

Number of shared servers:

Alter systemset shared_servers = 1 scope = both;

Maximum number of shared servers:

Alter systemset max_shared_servers = 5 scope = both;

2. Parameter: DISPATCHERS

Alter systemset dispatchers = '(PROTOCOL = TCP) (SERVICE = zrgXDB )';

The ORACLE document states that this parameter is optional and will match any protocol and service if not configured. However, when you set the parameters to control during the test, logon fails.

PROTOCOL indicates the connection PROTOCOL.

The SERVICE that allows the Shared Server.

3. In the tns settings of tnsnames. ora on the client side, change the value of server dedicated to SHARED in the CONNECT_DATA setting so that you can connect to the shared server.

5.3 TNS Configuration

Configure the TNS in the client as follows:


Based on the listener status, the Service zrgXDB.zrg.com can configure the Shared Server connection:

DBZRG =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.199.134) (PORT = 1521 ))

(CONNECT_DATA =

(SERVER = SHARED)

(SERVICE_NAME = zrgXDB.zrg.com)

)

)

If we change SERVICE_NAME to orcl.zrg.com or pdbzrg.zrg.comORA-12520: TNS: The Listener cannot find the available handle for the desired server type.

The dedicated server connection can be configured as follows:

DBZRG =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.199.134) (PORT = 1521 ))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = zrgXDB.zrg.com)

)

)

The dedicated server mode is supported by the database by default, so no configuration is required. The Shared Server must be configured and enabled. The Shared Server mode is supported, and you can also connect to the dedicated server mode.

We can also replace SERVICE_NAME with SID = epps, and use epps as the connected instance. If a service uses a shared server, you can establish a shared server connection or a dedicated server connection.

6. Server Mode judgment

To determine whether a Shared Server is enabled, you can start with the following view:

1. V $ session


We can see that PL/SQL DEVELOPER has established a SHARED SERVER mode with the instance: the SERVER type is SHARED. If it is NONE, the SHARED SERVER is enabled. You can also find that all the background processes of the system have started the dedicated server process.

2. V $ shared_server

Start the Shared Server:


Disable the Shared Server:


This parameter changes only when the session of the created Shared Server ends.

3. V $ circuit


If the query result is displayed, the sharing mode is enabled. Otherwise, no judgment can be made.

4. View listener status


From the above information, we can see that a service zrgXDB.zrg.com uses a shared server with a scheduler "D000" and two services, orcl.zrg.com, and pdbzrg.zrg.com, uses a dedicated server.

7. Disable Shared Server Mode

Set the value of shared_servers to 0 to disable the Shared Server mode.

The command is as follows:

Alter systemset shared_servers = 0;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.