Shared Servers & Dedicated Server Managing

                                        Introduction:
A Process is a "thread of control" or a mechanism in an operating system that can execute a series of steps. A single Process can have multiple threads of execution. This simply means that a single multithreaded Process can do the work of multiple single-threaded Processes. The advantage of a multithreaded Process is that it can do the work of many single-threaded Processes but requires far less system overhead. If a database Server uses multithreaded Server Processes, it can support large numbers of clients with minimal system overhead. The goals of a Process structure are:



-To stimulate a private environment for mutiple Processes to work simultaneously
-To allow multiple Processes to share computer resources

The Process architecture, is designed to maximize performance. A client/Server system splits Processing two different components.

Client Process:
Responsible for executing a client application on a workstation.

Server Process:
-Foreground Server Processes
-Background Server Processes

Foreground Server Processes:
Directly handles the request from the client Process.

Background Server Processes:
Handle other specific jobs of the database Server.


Processes involved in the Shared Server are:
-A network Listener Process that connects user Processes to Dispatchers or to a dedicated Server Process.
-One or more Dispatcher Processes.
-One or more Shared Server Processes.

The network listener Process waits for incoming connection requests and determines if each user Process can use a shared Process. If so, the listener Process gives the user Process the address of a Dispatcher Process. If the user Process request for a dedicated Server, the listener Process creates a dedicated Process and connects the user Process to it. Shared Server Processes end dedicated Server Processes provide the same functionality, except shared Server Processes are not associated with a specific user Process. Instead, a shared Server Process serves any client request in the Multi-Threaded Server configuration.

Using Dedicated Server Processes:
-A database Server machine is currently running Oracle using multiple background Processes.
-A client workstation runs a database application such as SQL*Plus. It Attempts to establish a connection to the Server using SQL*Net driver. The database Server is currently running the proper ORACLE NET driver. The listener Process on the Database Server detects the connection request from the client. The user executes a single SQL statement.
-E.g. the user inserts a row into a table.
-The dedicated Server Process receives the statement. At this point, two paths can be followed to continue processing the SQL statement.
-If the shared pool contains a shared SQL area for an identical SQL statement, the Server Process can use the existing shared SQL area to execute the clients SQL statement.
-If the shared pool does not contain a shared SQL area for an identical SQL statement, a new shared SQL area is allocated for the statement in the shared pool.
-The background Process retrieves data block from the actual data file, if necessary, or uses the data blocks already stored in the buffer cache in the SGA of the instance.
-The Server Process executes the SQL statements stored in the shared SQL area. Data is first changed in the SGA. It is permanently written to disk when DBWR Process determines it is most efficient to do so.
-The LGWR process records the transaction in the on-line redolog file only on a subsequent commit request from the user.
-If the request is successful, the Server sends a message across the network to the user, else appropriate error message is transmitted.
-Throughout this entire procedure, the other background Processes are running and watching for any  conditions that require intervention. In addition, Oracle is managing other transactions and preventing contention between different transactions that request the same data.

Using Shared Server Process:
-A database Server is currently running Oracle using multi-threaded Server configuration.
-A client workstation runs a database application such as Oracle Forms.
-It attempts to establish a connection to the Server using ORACLE Net driver.
-The Database Server is currently running the proper ORACLE Net driver.
-The Listener Process on the database Server detects the connection request from the client application and determines how the User Process should be connected to the available Dispatcher.
-The user issues a SQL statement. For example, the user updates a row in a table.
-The Dispatcher Process places the User Process's request on the request queue which is in the SGA and shared by all Dispatcher Processes.
-An available shared Server Process checks the common Dispatcher request and picks up the next SQL statement on the queue. It then Processes the SQL statement as described in previous example. Once the previous shared Server Process finishes processing the SQL statement, the Process places the result on the response queue of the Dispatcher Process that sent the request.
-The Dispatcher Process checks its response queue and sends completed request back to the user Process that made the request.
-To implement Shared Server you have to set these parameters in init.ora


DISPATCHERS = "(PROTOCOL=TCP) (DISP=2)" (min. dispatchers for tcp to be started)
MAX_DISPATCHERS = 2 (max. number of dispathcers you want to start)
SHARED_SERVERS = 2 (min. number of server process you want to start)
MAX_SHARED_SERVERS = 5 (max. number of server processes)
LOCAL_LISTENER = (ADDRESS=(PROTOCOL=TCP) (HOST=192.168.0.12) (PORT=1521))


$lsnrctl start

$sqlplus /nolog


SQL>CONNECT / as sysdba


SQL>SHUTDOWN


SQL>STARTUP


SQL>EXIT

$SQLPLUS system/manager@alias (alias name is tnsnames.ora)

Simplified Shared Server Configuration:
Oracle 10g is shared server aware by default and a value greater than zero for SHARED_SERVERS parameter will enable the feature. The shared_server parameter is dynamic and hence can be enabled  or disabled.

SQL>ALTER SYSTEM SET SHARED_SERVERS=4 SCOPE=BOTH;

Note:
In oracle 10g we need not explicitly configure Dispatcher by default one Dispatcher is started.

To check whether shared server is working:

From operating system you can give this command to see whether SHARED SERVER is working:

$ps x|grep ora_    (check for (LOCAL=YES) or (LOCAL=NO), It should not appear).


All the database level we can query from the following

SQL>SELECT * FROM V$MTS;

SQL>SELECT * FROM V$DISPATCHER;

(Check to see changes in dispatcher busy time after some operations)

SQL>SELECT SERVER FROM V$SHARED_SERVER;


(Check to see any changes in shared servers busy time after some operations)


SQL>SELECT * FROM V$QUEUE;

SQL>SELECT username, server FROM V$SESSION;
(To see the whether the users are connected using shared server or dedicated server process)


The view V$DISPATCHER_CONFIG gives the information on the existing dispatchers.

SQL>SELECT dispatchers, connections, pool, listener FROM V$DISPATCHER_CONFIG;

No comments:

ORA-00059: Maximum Number Of DB_FILES Exceeded in 19C database

When I am adding datafile to my 19C database facing the below error. SQL> alter tablespace DATA  add datafile '/u01/data/data15.dbf...