查看oracle用户执行的sql语句历史记录

一时失误,删除了PL/SQL窗口数据的历史,然后半个半个星期写的代码全部白费,但是想起来之前执行过,所以可以通过查询历史记录找回。以下为找回代码:

平时用得少,保存一下以后查看。
 
select * from v$sqlarea t where t.PARSING_SCHEMA_NAME in ('用户名') order by t.LAST_ACTIVE_TIME desc     用户名需要大写

select * from v$sqlarea t order by t.LAST_ACTIVE_TIME desc


注意 :执行此语句等等一些相关的语句 必须具有DBA 的权限 虽然这条语句很普通 但是需要的时候很管用 能够及时查出一个人执行sql语句情况
-------oracle 查看已经执行过的sql 这些是存在共享池中的 --------->
select * from v$sqlarea t order by t.LAST_ACTIVE_TIME desc
-----------查看oracle会话----------------------------》
select * from v$session   t order by t.LAST_ACTIVE_TIME desc
-------------查看oracle的权限角色------------------------------>
select   *   from   dba_role_privs;    授予用户和其他角色的角色  
select   *   from   dba_sys_privs;     授予用户和其他角色的系统权限  
select   *   from   dba_tab_privs;     数据库中对象的所有授权
select * from user_role_privs;         查看当前用户的角色

posted on 2018-01-15 09:36  instr  阅读(6154)  评论(0编辑  收藏  举报

导航