oracle ~ 查找表的操作记录
1.查找操作表的历史纪录
select
*
from v$sqlarea a
where a.SQL_TEXT like '%表名称%'
order by first_load_time desc;
2.从上面的记录中找到update语句对应的sql_id
select
*
from v$sqltext a,v$sqlarea b
where a.SQL_ID=b.SQL_ID and b.SQL_ID in('23bpngg54gf2j')
order by b.LAST_ACTIVE_TIME desc;
3.从上面的记录中找到最新的sql操作记录,然后找到用户名和主机
select
osuser as 客户端操作系统的用户名,
TERMINAL as 客户端运行的终端名,
MACHINE as 客户端的机器名,
PROGRAM as 客户端执行的程序名,
USERNAME,
LAST_ACTIVE_TIME,
logon_time
from sys.v_$session l,sys.v_$sql s
where s.SQL_ID='b5sgbqgwjh39g' and l.USERNAME is not null
order by logon_time desc