Oracle v$PROCESS

Introduction to v$session/V$PROCESS view

(This blog is a reference to other people's blogs, plus my own understanding)

 

Server process concept:

The Oracle server process is automatically created by the Oracle instance to handle requests from client processes connected to the instance. Users must connect to the Oracle server process to obtain information in the database.
For the dedicated server mode (default when the database is built), the client process and the Oracle server process are in one-to-one correspondence. When adding a new server process, the approximate memory required is: AIX 5-10M; LINUX 3-5M memory--the actual measurement is more than 1M.
In the shared server mode, an Oracle server process may serve multiple client processes at the same time.                  
The server process is mainly used to perform the following tasks:
 parsing and executing the SQL statement submitted by the client.
Read the necessary data blocks from the disk data file to the data buffer area of ​​SGA.
Return the SQL statement execution result in an appropriate form.

user process user process concept

The client uses tools such as SQLPLUS/PLSQL to connect to the server process of the database server through the service name in tnsnames.ora. To go through monitoring - server process - PGA.
The relationship between PROCESSES and SESSIONS number:    --
11g official default value: sessions=1.5*processes + 22 document: http://docs.oracle.com/cd/E11882_01/server.112/e40402/initparams234.htm#sthref696
10g official default value: sessions=1.1*process es+5 documentation: http://docs.oracle.com/cd/B19306_01/server.102/b14237/initparams191.htm#REFRN10197

 

 

The relationship between connection and session:

Connection:
The communication channel communication pathway between the user process and the Oracle instance.
This communication channel is established through interprocess communication mechanisms (user processes and Oracle processes run on the same computer) or network software network software (when the database application and the Oracle server run on different computers, they need to communicate through the network).
Session:   --In dedicated server mode, one connection corresponds to one session.
Mainly refers to the connection between the user and the database.
For example, a valid user name and password must be provided when a user starts SQL*Plus, after which Oracle establishes a session for this user. A session lasts from the time the user connects until the user disconnects (or exits the database application).
For example: use PLSQL to connect to the database, there is a connection, and there is a corresponding session. Opening a SQL window in PLSQL is another connection, and there is also a session accordingly.
Query in the SQL window opened in PLSQL:
select sid from v$mystat where rownum=1;
40
select b.spid,a.sid,a.username,a.program,a.machine from v$session a,v$process b where a.paddr=b.addr and a.type='USER';(This statement lists the pid of the session (session) and the spid corresponding to the operating system level of the session. Because it is a proprietary mode, a session corresponds to a process of oracle. If the spid of the session is killed at the operating system level, that is, kill -9 spid, the session will be killed and the user cannot connect to the database. )


30152 51 BYS     plsqldev.exe     WORKGROUP\BYS   ---This is the session information for opening PLSQL software to connect to the database
30187 40 BYS plsqldev.exe WORKGROUP\BYS  --This is the session information corresponding to the SQL window in the current PLSQL

Query on the LINUX system running the database: ---The PID of the process can correspond to the one queried in PLSQL.
[oracle@bys3 ~]$ ps -ef |grep LOCAL |grep -v grep
oracle    30152      1 1 21:01 ? 00:00:02 oraclebys3 (LOCAL=NO)       -- corresponding to the session of PLSQL program
oracle    30187      1 0 21:02 ? 00:00:00 oraclebys3 (LOCAL=NO) -- corresponding to PL SQL Window in SQL
#######################

If you use kill -9 30152 on linux, then through select b.spid,a.sid,a.username,a.program,a.machine from v$session a,v$process b where a.paddr=b.addr and a.type='USER'; the found session will be killed. This is to kill the user's session through the pid at the operating system level. If you use it again, the pid is 30152 session to query database related information, the following error will occur:

SQL> select 2*3 from dual;

select 2*3 from dual

*

ERROR at line 1:

ORA-03135: connection lost contact

Process ID: 30152

Session ID: 42 Serial number: 199



Use SQLPLUS test: --Experimental environment, there is no connection to the database now.
[oracle@bys3 ~]$  ps -ef |grep LOCAL |grep -v grep ---The query does not return, there is no connection information of ORACLE in the current system,
then open another window 2, SSH to the server where the database is located, and start SQLPLUS to log in to the database. Then query:
[oracle@bys3 ~]$ ps -ef |grep LOCAL |grep -v grep
oracle 30305 30302 3 21:10 ? 00:00:00 oraclebys3 (DESCRIPTION=( LOCAL=YES )(ADDRESS=(PROTOCOL=beq)))  --This is the information about the newly opened SQLPLUS connection in window 2  LACAL =YES, indicating that it is not connected by listening -- local IPC

V$MYSTAT--This is mainly to check the current session SID

SID Display the SID of the current session
STATISTIC# Statistic number
VALUE Statistical value
################################################

 

 

v$process view

   Function: The v$process view contains information about all processes running in the current system oracle. It is often used to establish a relationship between the operating system process ID of the oracle or service process and the database session.

Table Structure

SQL> desc v$process;

 Name    Null?    Type

 ADDR     RAW(8)

 PID     NUMBER

 SPID     VARCHAR2(24)

 PNAME     VARCHAR2(5)

 USERNAME     VARCHAR2(15)

..........................................................

 

V$PROCESS

ADDR and PADDR in v$session correspond to
PID Oracle process identifier, including ORACLE background process and user process. Check select pid,pname from v$process;
process ID in SPID ORACLE--ps -ef |grep LOCAL Find the process number
PROGRAM Display the program used-such as [email protected] (SMON) background process [email protected] (TNS V1-V3) The server directly connects to [email protected] User process background
value connected by monitoring 1, is a background process. NULL means that it is a new field in the ordinary user process
TRACEID     
TRACEFILE 11G, which shows the specific location of the TRACEFILE of the current process.
LATCHWAIT Address of the lock waiting for; NULL, no lock
LATCHSPIN Address of the latch the process is spinning on; NULL if none

 

 

Guess you like

Origin blog.csdn.net/qq_34556414/article/details/81741924#comments_27323173
Recommended