通过操作系统进程找到top sql信息
SELECT 'USERNAME :' || s.username || chr(10) || 'SCHEMA:' || s.schemaname ||
chr(10) || 'OSUSER:' || s.osuser || chr(10) || 'SPID:' || p.spid ||
chr(10) || 'SID:' || s.sid || chr(10) || 'SERIAL#:' || s.serial# ||
chr(10) || 'KILL STRING: ' || '''' || s.sid || ',' || s.serial# || '''' ||
chr(10) || 'MACHINE: ' || s.machine || chr(10) || 'TYPE:' || s.type ||
chr(10) || 'SQL_ID:' || q.sql_id || chr(10) || 'SQL_TEXT: ' ||
q.sql_text
FROM v$session s, v$process p, v$sql q
WHERE s.paddr = p.addr
AND p.spid = '&PID_FROM_OS'
AND s.sql_id = q.sql_id(+)
'USERNAME:'||S.USERNAME||CHR(10)||'SCHEMA:'||S.SCHEMANAME||CHR(10)||'OSUSER:'||S
--------------------------------------------------------------------------------
USERNAME :RPT
SCHEMA:RPT
OSUSER:zed
SPID:54657092
SID:1854
SERIAL#:35907
KILL STRING: '1854,35907'
MACHINE: aix
TYPE:USER
SQL_ID:4wv8ms79s6m37
SQL_TEXT: SELECT '073000' AS TIMEKEY FROM DUAL
'USERNAME:'||S.USERNAME||CHR(10)||'SCHEMA:'||S.SCHEMANAME||CHR(10)||'OSUSER:'||S
SQL> select * from table(dbms_xplan.display_cursor(('&sql_id')));
Enter value for sql_id: 4wv8ms79s6m37
old 1: select * from table(dbms_xplan.display_cursor(('&sql_id')))
new 1: select * from table(dbms_xplan.display_cursor(('4wv8ms79s6m37')))
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
SQL_ID 4wv8ms79s6m37, child number 0
-------------------------------------
SELECT '073000' AS TIMEKEY FROM DUAL
Plan hash value: 1546270724
-----------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-----------------------------------------------------------------
| 0 | SELECT STATEMENT | | | 2 (100)| |
| 1 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
13 rows selected.
也可以通过另外一种方式
SQL> conn / as sysdba
Connected.
SQL> oradebug setospid 54657092
Oracle pid: 45, Unix process pid: 54657092, p_w_picpath: oracle@aix (TNS V1-V3)
SQL> oradebug current_sql;
SELECT '235959' AS TIMEKEY FROM DUAL
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341