How do I show running processes in 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 中显示正在运行的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Oracle DB 中显示正在运行的进程?
基础教程推荐
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 在 SQL 中连接多个表 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 无法解决整理冲突 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
