如何在 Oracle DB 中显示正在运行的进程?

How do I show running processes in Oracle DB?(如何在 Oracle DB 中显示正在运行的进程?)
本文介绍了如何在 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 中显示正在运行的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)