oracle查询历史操作记录

示例:

sql 复制代码
SELECT
	substr( a.sql_text, 1, 256 ) "SQL Text",
	( SELECT b1.username FROM all_users b1 WHERE b1.user_id = a.parsing_user_id ) "Parsing User Name",
	a.users_executing "Users Executing",
	a.rows_processed "Rows Processed",
	a.loads "Loads",
	a.sorts "Sorts",
	a.parse_calls "Parse Calls",
	a.disk_reads "Disk Reads",
	a.buffer_gets "Buffer Gets",
	a.persistent_mem "Persistent Memory",
	a.runtime_mem "Runtime Memory",
	a.sharable_mem "Sharable Memory",
	a.kept_versions "Kept Versions",
	a.loaded_versions "Loaded Versions",
	a.serializable_aborts "Serializable Aborts",
	a.invalidations "Invalidations",
	a.first_load_time "First Load Time",
	a.cpu_time "CPU Time ",
	a.elapsed_time "Elapsed Time",
	a.optimizer_mode "Optimizer Mode",
	a.command_type "Command Type ",
	a.executions "Executions",
	a.fetches "fetches",
	a.address || ':' || a.hash_value "SQL Address & Hash Value",
	a.sql_id "SQL Id" 
FROM
	v$sqlarea a 
WHERE
substr(a.sql_text,0,6) = 'delete'
AND TO_DATE(a.first_load_time,'yyyy-mm-dd hh24:mi:ss') > to_date('2022/1/24 14:00:00','yyyy-mm-dd hh24:mi:ss')
and a.sql_text LIKE '%plm_cusl_lkprtrqbilltofile%'
 	a.parsing_user_id != ( SELECT b1a.user_id FROM all_users b1a WHERE b1a.username = 'SYS' ) 
 	
 	
	AND nls_upper( a.sql_text ) LIKE : 1
	AND TO_DATE(a.first_load_time,'yyyy-mm-dd hh24:mi:ss') > to_date('2022/1/24 15:00:00','yyyy-mm-dd hh24:mi:ss')

全查:

sql 复制代码
SELECT
	* 
FROM
	v$sql 
WHERE
	last_load_time > '2023-03-14/15:47:20'
	AND sql_text like '%d3a161b9-80dc-467e-81c6-dedcd8841c97%'
	--AND sql_text not like '%8c561691-4bae-4425-a8bb-c4e8bde100d8%'
	AND service = 'SYS$USERS'
ORDER BY
	last_load_time ASC;
相关推荐
周全全7 分钟前
MySQL报错解决:The user specified as a definer (‘root‘@‘%‘) does not exist
android·数据库·mysql
白云如幻11 分钟前
MySQL的分组函数
数据库·mysql
荒川之神27 分钟前
ORACLE 闪回技术简介
数据库·oracle
时差9532 小时前
【面试题】Hive 查询:如何查找用户连续三天登录的记录
大数据·数据库·hive·sql·面试·database
让学习成为一种生活方式2 小时前
R包下载太慢安装中止的解决策略-R语言003
java·数据库·r语言
Mephisto.java2 小时前
【大数据学习 | kafka高级部分】kafka的优化参数整理
大数据·sql·oracle·kafka·json·database
秋意钟2 小时前
MySQL日期类型选择建议
数据库·mysql
Dxy12393102163 小时前
python下载pdf
数据库·python·pdf
桀桀桀桀桀桀4 小时前
数据库中的用户管理和权限管理
数据库·mysql
BearHan5 小时前
Sqlsugar调用Oracle的存储过程
oracle·存储过程·orm