1.查看undo表空间使用大于98%
2.查看视图v$undostat,确认MAXQUERYID 占用undo最大的sql,TUNED_UNDORETENTION和预设的show parameter undo undo_retention是否一致,理想是一致的。
select * from v$undostat;
MAXQUERYID : SQL identifier of the longest running SQL statement in the period
显示了运行最长时间的sql_id,可以通过这个字段查询出运行时间最长的SQL(连接v$sql视图)
TUNED_UNDORETENTION :oracle给出不同负荷下的undo_retention智能建议
3.将查到耗费时间最长的sql,通过v$sql确认sql语句,并查看执行计划
select * from v$sqlarea where sql_id='50urngxayuzb0'
ps一下:show parameter undo
Undo配置参数含义
UNDO_MANAGEMENT undo的管理模式,分自动和手动
UNDO_TABLESPACE 当前正在被使用的undo表
UNDO_RETENTION 规定多长时间内,数据不能被覆盖。
AUTO 表示undo 为自动管理模式,使用的是undo表空间管理模式。
900 表示在900秒内,undo上的数据不能被覆盖。
UNDOTBS1 是当前正在使用的undo表空间