如何找出哪个用户执行了 SQL 语句?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8707636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 13:48:04  来源:igfitidea点击:

How to find out which user executed an SQL statement?

sqloracle

提问by Oh Chin Boon

I have the following SQL query ran and reflected in TOP SQL report, am i able to find out the user who executed the SQL from Oracle?

我运行了以下 SQL 查询并反映在 TOP SQL 报告中,我能找出从 Oracle 执行 SQL 的用户吗?

SELECT MIN(seq_id) 
  FROM my_log 
 WHERE seq_id >= 1

回答by Wilmer

In Oracle 10g:

在 Oracle 10g 中:

SELECT a.username,
       b.sql_text,
       a.status
FROM   v$session a
       INNER JOIN v$sqlarea b
         ON a.sql_id = b.sql_id; 

回答by Gaius

Get the SQL_ID of this statement, then look in the active session history.

获取此语句的 SQL_ID,然后查看活动会话历史记录

回答by PlexQ

I'm sure, but have you looked in select * from V$SQL?

我敢肯定,但是您是否查看过 select * from V$SQL?