Saturday, August 7, 2010

How the server process being created

Case 1: connecting through listener, and listener fork() itself and exec() to load oracle image to replace it. the server's parent process id will be same as listener's.

SQL> conn donghua/donghua@orcl
Connected.

SQL> select spid, process clientid from v$session s, v$process p where s.sid=userenv('SID') and s.paddr=p.addr;

SPID CLIENTID
------------------------ ------------------------
10908 10818

SQL> ! ps -ef|grep -e 10908 -e 10818 -e tnslsnr |grep -v grep
oracle 4233 1 0 18:34 ? 00:00:00 /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr LISTENER -inherit
oracle 10818 10784 0 21:00 pts/1 00:00:00 sqlplus
oracle 10908 1 0 21:02 ? 00:00:00 oracleorcl (LOCAL=NO)


Case 2, connecting server without listener
In this case, the client process(for example, sqlplus) forks the new server process and loads oracle's image.

SQL> conn donghua/donghua
Connected.
SQL> select spid, process clientid from v$session s, v$process p where s.sid=userenv('SID') and s.paddr=p.addr;

SPID CLIENTID
------------------------ ------------------------
11036 10818

SQL> ! ps -ef|grep -e 11036 -e 10818 -e tnslsnr |grep -v grep
oracle 4233 1 0 18:34 ? 00:00:00 /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr LISTENER -inherit
oracle 10818 10784 0 21:00 pts/1 00:00:00 sqlplus
oracle 11036 10818 0 21:07 ? 00:00:00 oracleorcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))