按用户查看 SQL 历史记录 [Oracle] [英] View SQL History by User [Oracle]

查看:218
本文介绍了按用户查看 SQL 历史记录 [Oracle]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我们的 Oracle 11g 数据库中按用户查找所有(可用)SQL 历史记录.我尝试使用诸如 v$sql_monitorv$sqlareadba_hist_active_sess_history 之类的视图来尝试获取用户名及其执行的 SQL语句(加入 SID 和序列号),但我没有任何运气.我们的高级 DBA 和 DBE 说他们以前做过,但只是告诉我查看 sqlarea,因为它拥有最长的 SQL 历史.我对此没有任何运气.这可以在 Oracle 中实现吗?

I'm trying to find all (available) SQL history by user in our Oracle 11g database. I've tried using some view such as v$sql_monitor, v$sqlarea, and dba_hist_active_sess_history to try to get usernames, and their executed SQL statements (joined on SID and Serial #) but I'm not having any luck. Our senior DBA and DBE said they've done it before but just told me to look in sqlarea since that has the longest history of SQL held. I'm not having any luck with this. Is this possible to do in Oracle?

我们使用 SQL Developer.我知道 TOAD 可能内置了此功能,也可能没有,但我无法在 SQL Developer 中找到实现此功能的任何内容(除了查看当前会话和当前 SQL).

We use SQL Developer. I understand that TOAD may or may not have this feature built-in but I haven't been able to find anything that accomplishes this (other than view current sessions and current SQL) in SQL Developer.

推荐答案

我认为获取用户的确切 SQL 执行(我认为你是说会话?)的唯一方法是启用跟踪.我认为这篇文章(https://oracle-base.com/articles/misc/sql-trace-10046-trcsess-and-tkprof) 为您提供了如何使用它的很好的说明.

I think the only way to fetch the exact SQL-Executions of a User (i think you mean Session?) is by enabeling Tracing. I think this article (https://oracle-base.com/articles/misc/sql-trace-10046-trcsess-and-tkprof) gives you a good instruction how it is used.

这篇关于按用户查看 SQL 历史记录 [Oracle]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆