如何显示Oracle DB中正在运行的进程? [英] How do I show running processes in Oracle DB?

查看:60
本文介绍了如何显示Oracle DB中正在运行的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Oracle数据库上显示正在进行的其他进程?像Sybases sp_who

Is it possible to show other processes in progress on an Oracle database? Something like Sybases sp_who

推荐答案

我怀疑您只想从V $ SESSION中获取一些列,并从V $ SQL中获取SQL语句.假设您要排除Oracle本身正在运行的后台进程

I suspect you would just want to grab a few columns from V$SESSION and the SQL statement from V$SQL. Assuming you want to exclude the background processes that Oracle itself is running

SELECT sess.process, sess.status, sess.username, sess.schemaname, sql.sql_text
  FROM v$session sess,
       v$sql     sql
 WHERE sql.sql_id(+) = sess.sql_id
   AND sess.type     = 'USER'

外部联接用于处理当前未处于活动状态的那些会话,假设您需要这些会话.您还可以从V $ SQL获取sql_fulltext列,该列将具有完整的SQL语句,而不是前1000个字符,但这是一个CLOB,因此处理起来可能会有些复杂.

The outer join is to handle those sessions that aren't currently active, assuming you want those. You could also get the sql_fulltext column from V$SQL which will have the full SQL statement rather than the first 1000 characters, but that is a CLOB and so likely a bit more complicated to deal with.

实际上,您可能希望查看V $ SESSION中可用的所有内容,因为您可能会获得比SP_WHO提供的更多的信息.

Realistically, you probably want to look at everything that is available in V$SESSION because it's likely that you can get a lot more information than SP_WHO provides.

这篇关于如何显示Oracle DB中正在运行的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆