When you are dealing with Shared Server there are some things that you have to know in order to understand what is going on in your database. Last night I was talking with a friend who asked me "Hey why my shared server configuration is not working?" He said that he read in the Oracle Documentation that the only parameter in order to configure shared server is "shared_servers". Indeed, he was right, but why his configuration was not working? Well, I asked him why and said the following:
"I see the SERVER column in the v$session view says NONE".
Maybe this is a well known value for the SERVER column in v$session for all the top DBAs in the world, however there are also people who don't know this, that's why I decided to write a little blog post on this.
My answer was simple: "Your configuration is well, but your session is not doing anything that's why you see NONE in the SERVER column. If it was a wrong configuration then you should see DEDICATED".
After that conversation I started to write this blog post and below my notes for you:
Current configuration:
SQL> show parameters dispatcher
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=ORCLXDB)
max_dispatchers integer
SQL> show parameter shared_servers
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
max_shared_servers integer
shared_servers integer 1
SQL>
Currently there is 1 Dispatcher and 1 Shared Server:
SQL> select pname, addr,pid from v$process where pname like 'D0%' or pname like 'S0%';
PNAME ADDR PID
----- ---------------- ----------
D000 000000009F4B9558 20 <--- Dispatcher
S000 000000009F4BB6C8 22 <--- Shared Server
Note: Keep in mind the PID number because we will use it later with oradebug
My dispatcher is accepting connections:
SQL> select name, status, accept, messages, breaks,owned from v$dispatcher;
NAME STATUS ACC MESSAGES BREAKS OWNED
---- ---------- --- -------- ------ -----
D000 WAIT YES 0 0 0
And my shared server is "new" with no work currently:
SQL> select name, paddr, status, messages from v$shared_server
NAME PADDR STATUS MESSAGES
---- ---------------- --------------- --------
S000 000000009F4BB6C8 WAIT(COMMON) 0
SQL>
Let's create a session using "shared"
[oracle@a1 ~]$ sqlplus dgomez/dgomez@a1.oracle.com:1521/orclxdb:shared
Now in owned says "1" and messages it says "28" which means there is activity, you can see the documentation for v$dispatcher for further information ...
SQL> select name, status, accept, messages, breaks,owned from v$dispatcher;
NAME STATUS ACC MESSAGES BREAKS OWNED
---- ---------- --- -------- ------ -----
D000 WAIT YES 28 0 1
Now let's see the SERVER column in v$SESSION:
SQL> select username, server, service_name , PADDR from v$session where username='DGOMEZ';
USERNAME SERVER SERVICE_NAME PADDR
------------------------------ --------- ---------------------------------------------------------------- ----------------
DGOMEZ NONE ORCLXDB 000000009F4B9558
Here is what my friend was saying... the value NONE. Let's confirm what I told him:
Confirmation #1: The process for my session is the dispatcher.
SQL> select NAME, STATUS, ACCEPT, MESSAGES, OWNED, PADDR from v$dispatcher where PADDR=(Select paddr from v$session where username='DGOMEZ');
NAME STATUS ACC MESSAGES OWNED PADDR
---- ---------- --- -------- ----- ----------------
D000 WAIT YES 2920 1 000000009F4B9558
SQL>
Confirmation #2:D000 shows also 1 current connection.
[grid@a1 ~]$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 02-OCT-2014 01:41:35
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "ORCLXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:1 refused:0 current:1 max:1022 state:ready
DISPATCHER <machine: a1.oracle.com, pid: 6824>
(ADDRESS=(PROTOCOL=tcp)(HOST=a1.oracle.com)(PORT=31843))
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
Ok, so far we know that the dispatcher process is managing our session but then why "NONE", as I said it is because of no work doing by our session. I will use oradebug in order to suspend S000 that way we can see that when my session is doing something the SERVER column in V$SESSION shows "SHARED":
SQL> oradebug setorapid 22 <--do you remember the pid of Shared server process?
Oracle pid: 22, Unix process pid: 6828, image: oracle@a1.oracle.com (S000)
SQL>
Session with dgomez user: SQL> select * from user_tables;
SQL> oradebug suspend
Statement processed.
SQL> select username, server, service_name , PADDR from v$session where username='DGOMEZ';
USERNAME SERVER SERVICE_NAME PADDR
------------------------------ --------- ---------------------------------------------------------------- ----------------
DGOMEZ SHARED ORCLXDB 000000009F4BB6C8
The column has "SHARED" and the address"000000009F4BB6C8" is the address of the Shared Server Process. As you can see this value is showed only while the Shared Server is working:
SQL> select name, paddr, status, messages from v$shared_server;
NAME PADDR STATUS MESSAGES
---- ---------------- --------------- --------
S000 000000009F4BB6C8 EXEC 4363
Follow me: