Previous | Table of Contents | Next |
As a service request is intercepted by an Oracle server, the listener may direct the request via a dedicated server, an MTS, or an existing process (pre-spawned shadow). The key is whether the connection contacts the listener via a service name, or bypasses the listener with the two_task connect string. If the listener is contacted as part of the connection and the MTS parms are defined to init.ora, the client will use the MTS.
There are five basic listener commands: RELOAD, START, STOP, STATUS, and SERVICES. Based on the request, the listener decides whether to dispatch a connection to a dedicated-server process (which it spawns) or to use the MTS. The programmer has several options when deciding how Oracle will manage the process. Dedicated requests can be specified by a version 1.0 connect string, or by using a service name that specifies server=dedicated in the tnsnames.ora file.
Note: Local connections will use the listener if the MTSs are defined. Even internal invocations to Oracle (for example, sqlplus/) will add a connection to the MTS.
Listing 8.4 describes some of the utilities you can use to manage SQL*Net sessions effectively. You should be aware that some of the examples in this section are operation system-independent, and may not apply to your environment.
Listing 8.4 Commit point strength.
commit.sql - Reports the commit point strength for the database. SET FEEDBACK OFF COLUMN NAME FORMAT a30 HEADING 'Name' COLUMN TYPE FORMAT a7 HEADING 'Type' COLUMN VALUE FORMAT a60 HEADING 'Value' PROMPT Commit Point-strength Report Output: PROMPT PROMPT SELECT NAME, DECODE(type,1,'boolean', 2,'string', 3,'integer', 4,'file') type, REPLACE(replace(value,'@','%{sid}'),'?','%{home}') VALUE FROM v$parameter WHERE NAME = 'commit_point_strength';
Showing And Killing SQL*Net Sessions
On systems running SQL*Net 2.0, you can use a session script to query the number of dedicated and shared servers on the system. For example, Listing 8.5, which appears later in this chapter, shows all connected users and their type of connection to the Oracle database.
Unlike dedicated SQL*Net sessions, you cannot kill multithreaded SQL*Net sessions directly from the Unix operating system. For example, you can identify a runaway session on a dedicated server by using the Unix ps-ef|grep ora command, and subsequently kill it using the kill -9 nnn command. With the multithreaded server, operating system processes no longer exist for each separate task, and you must use the Oracle SQL ALTER SYSTEM KILL SESSION command to kill the task at the Oracle subsystem level (using the ALTER SYSTEM KILL SESSION sid, ser#; command).
To kill a user in an MTS session, first enter SQL*Plus and type:
SELECT sid, serial#, USERNAME FROM v$session; SID SERIAL# USERNAME 8 28 OPS$xxx 10 211 POS$yyy 13 8 dburleso
If dburleso is the session you want to kill, enter the ALTER SYSTEM KILL SESSION 13, 8 command.
This cumbersome method of clobbering runaway SQL*Net connections can be very annoying in development environments where dozens of programmers are testing programs, and they must call the DBA every time they want to kill a runaway task. The only alternative, however, is to grant the programmers ALTER SYSTEM authority on test platforms.
Managing The Multithreaded Server (MTS)
One of the problems with SQL*Net version 1.0 was that each incoming transaction was spawned by the listener as a separate operating system task. With SQL*Net version 2.0, Oracle now has a method for allowing the listener connection to dispatch numerous subprocesses. With the MTS, all communications to a database are handled through a single dispatcher instead of separate Unix process IDs (PIDs) on each database. This translates into faster performance for most online tasks. Even local transactions will be directed through the MTS, and you will no longer see a PID for your local task when you issue ps-ef|grep oracle.
However, be aware that the MTS is not a panacea, especially at times when you want to invoke a dedicated process for your program. For Pro*C programs and I/O-intensive SQL*Forms applicationsor any processes that have little idle timeyou may derive better performance using a dedicated process.
In general, the MTS offers benefits such as reduced memory use, fewer processes per user, and automatic load balancing. However, it is often very confusing to tell whether the MTS is turned onmuch less working properly.
Remember the following rules of thumb when initially starting the MTS:
SQLDBA> ALTER SYSTEM SET MTS_DISPATCHERS = 'TCPIP,4';
SQLDBA> ALTER SYSTEM SET MTS_SERVERS=0;
remote_os_authent = true remote_os_roles = true
Previous | Table of Contents | Next |