ORA01873 故障处理
错误解释
oerr ora 1873 查看错误解释
01873, 00000, “the leading precision of the interval is too small” “区间间隔精度太小”
// *Cause: The leading precision of the interval is too small to store the specified interval.
// *Action: Increase the leading precision of the interval or specify an interval with a smaller leading precision.
//*原因:间隔的前导精度太小,无法存储指定的间隔。
//*操作:增加间隔的前导精度或指定前导精度较小的间隔。
背景
某用户反馈查询定时任务时数据库报错ORA-01873的问题。这个问题导致无法查看和管理定时任务。
发现问题是由于定时任务的视图DBA_JOB的定义中,时间间隔的计算方式有BUG所导致的。经过充分测试手动调整了DBA_JOBS视图的计算方式。通过这一调整,我们成功地解决了这个问题,保障了系统的稳定健康运行。
根本原因
问题的根本原因是Oracle计算两个timestamp时间戳的间隔时间,再乘上86400(1天的秒数)超出了时间间隔类型(interval)的精度范围,出现查询报错。
问题复现
SYS@ORCL(orcl): 2> select * from dba_jobs;
ERROR:
ORA-01873: the leading precision of the interval is too small
SYS@ORCL(orcl): 2> select TOTAL_TIME from dba_jobs;
ERROR:
ORA-01873: the leading precision of the interval is too small