zoukankan      html  css  js  c++  java
  • [Oracle工程师手记] 通过 lsof 命令查找oracle client 端和 server 端进程

    通过 lsof 命令,可以找到 Oracle 的 client 端 和 server 端的进程。

    例如,我从远端连接到 oracle 数据库:

    -bash-4.1$ sqlplus sys/oracle@my19c as sysdba
    
    SQL*Plus: Release 12.2.0.1.0 Production on Sat Apr 10 03:45:20 2021
    
    Copyright (c) 1982, 2016, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    
    SQL>
    

     
    在 server 端,我可以通过 LOCAL=NO 关键字,找到为远端client 服务的进程:

    [oracle@celvpvm06027 ~]$ ps -ef | grep oracle | grep LOCAL
    oracle    4609     1  0 02:45 ?        00:00:00 oracledb193cdb (LOCAL=NO)
    oracle   29721 29696  0 02:55 pts/0    00:00:00 grep --color=auto LOCAL
    [oracle@celvpvm06027 ~]$
    

    可以看到,服务器端进程ID 是 4609。

    这时,通过 lsof ,可以找到与之进行网络通信的client 端进程:

    [oracle@celvpvm06027 ~]$ lsof -p 4609 | grep ESTABLISHED
    oracle_46 4609 oracle   16u     IPv6 492894739       0t0       TCP my06027.mytst.com:ncube-lm->my05200.mytst.com:62311 (ESTABLISHED)
    [oracle@celvpvm06027 ~]$
    

     
    我在client 端,用上面查询得到的 62311 ,通过 lsof 来查询:

    -bash-4.1$ lsof | grep 62311
    sqlplus    6123    oracle    9u     IPv4            4946370       0t0        TCP my05200.mytst.com:62311->my06027.mytst.com:ncube-lm (ESTABLISHED)
    -bash-4.1$
    
    -bash-4.1$ ps -ef | grep 6123
    oracle    6123  5861  0 03:45 pts/0    00:00:00 sqlplus                  as sysdba
    oracle    7031  6183  0 03:58 pts/1    00:00:00 grep 6123
    -bash-4.1$
    

     
    可以得知,client 端进程 ID 是 6123。

  • 相关阅读:
    FASTJSON
    数据库索引(转)
    设计模式
    jQuery EasyUI教程之datagrid应用(三)
    EasyUI---tree
    EasyUI、Struts2、Hibernate、spring 框架整合
    eclipse最有用快捷键整理
    框架整合----------Hibernate、spring整合
    jQuery EasyUI教程之datagrid应用(二)
    marquee 标签 文字滚动
  • 原文地址:https://www.cnblogs.com/gaojian/p/14640168.html
Copyright © 2011-2022 走看看