Oracle中查看正在运行的SQL进程脚本分享

网络编程 2021-07-05 16:08www.168986.cn编程入门
这篇文章主要介绍了Oracle中查看正在运行的SQL进程脚本分享,本文使用脚本实现了类似mysql show processlist命令的功能,需要的朋友可以参考下

Oracle的show processlist

代码如下:

set linesize 400;
set pagesize 400;
col sql_text format a100;
col machine format a25;
col username format a15;
SELECT a.username,a.machine, b.sql_id, b.SQL_TEXT
FROM v$session a, v$sqlarea b
WHERE a.sql_address = b.address
    AND a.SQL_HASH_VALUE = b.HASH_VALUE;

Oracle show full processlist

代码如下:

set linesize 400;
set pagesize 400;
set long 4000;
col SQL_FULLTEXT format a100;
col machine format a25;
col username format a15;
SELECT a.username,a.machine, b.sql_id, b.SQL_FULLTEXT
FROM v$session a, v$sqlarea b
WHERE a.sql_address = b.address
    AND a.SQL_HASH_VALUE = b.HASH_VALUE;

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by