根据session sid查系统层面对应的进程pid以及top单独查某进程数据

时间:2023-01-15 20:57:27
文档课题:根据session sid查系统层面对应的进程pid以及top单独查某进程数据.
1、查系统层面pid
SQL> select sid,serial# from v$session where sid=28;

SID SERIAL#
---------- ----------
28 62762

SQL> select pro.spid from v$session ses,v$process pro where ses.sid='28' and ses.paddr=pro.addr;

SPID
------------------------
16483
[oracle@dbserver ~]$ ps -ef|grep 16483
oracle 16483 1 0 18:48 ? 00:00:00 oracleorclcdb (LOCAL=NO)
oracle 16819 6036 0 19:45 pts/2 00:00:00 grep --color=auto 16483
[oracle@dbserver ~]$ kill -9 16483
SQL> select sysdate from dual;
select sysdate from dual
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 16483
Session ID: 28 Serial number: 62762
2、查指定进程
[oracle@dbserver ~]$ top -p 16836
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.1 us, 0.2 sy, 0.0 ni, 99.1 id, 0.1 wa, 0.5 hi, 0.1 si, 0.0 st
MiB Mem : 7672.2 total, 251.2 free, 2721.1 used, 4699.9 buff/cache
MiB Swap: 8092.0 total, 8006.7 free, 85.2 used. 848.0 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16836 oracle 20 0 2842952 78872 74836 S 0.0 1.0 0:00.02 oracle_16836_or