Error: WMS_STOCK源
无法处理这些数据。ORA-01555:快照过旧:回退段号39 (名称为"_SYSSMU39_3029844184$")过小
DG上DB的alert日志:
ORA-01555 caused by SQL statement below (SQL ID: gyjxsr15qwqqy, Query Duration=1834 sec, SCN: 0x0001.68c59971):
select a.WHSEID, 'HBRDC' as WMS_RDCCode,a.StorerKey, b.Lottable03, c.Description , b.Lottable08, a.Loc, d.SKUGroup2 MaterialCode, d.SKUGroup SizeName, a.SKU, d.BUSR2, d.BUSR3, d.busr9, d.busr10, SUSR4, sum(nvl(a.Qty, 0)) Qty from WMWHSE1.Lotxlocxid a inner join WMWHSE1.Lotattribute b on a.Lot = b.Lot inner join WMWHSE1.Codelkup c on b.Lottable03 = c.Code and c.ListName = 'STOCK' inner join WMWHSE1.SKU d on a.StorerKey = d.Storerkey and a.SKU = d.SKU where a.Qty > 0 group by a.WHSEID, a.StorerKey, b.Lottable03,c.Description, b.Lottable08, a.Loc, d.SKUGroup2, d.SKUGroup, a.SKU, d.BUSR2, d.BUSR3, d.busr9, d.busr10, SUSR4
这句SQL执行1834s
判断原因:
SQL语句执行时间太长,或者UNDO表空间过小,或者事务量过大,或者过于频繁的提交,导致执行SQL过程中进行一致性读时,SQL执行后修改的 前镜像(即UNDO数据)在UNDO表空间中已经被覆盖,不能构造一致性读块(CR blocks)。 这种情况最多。
解决办法:
第1种情况解决的办法:
(1)增加UNDO表空间大小
(2)增加undo_retention 时间,默认只有15分钟
alter system set undo_retention=14400 ;
undo_retention这个值可以根据情况调大一些。
(3)优化出错的SQL,减少查询的时间,首选方法
(4)避免频繁的提交
SQL> show parameter undo_retention;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_retention integer 900
把undo_retention修改为3600s
SQL> alter system set undo_retention = 3600;
System altered.
SQL> show parameter undo_retention;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_retention integer 3600
再执行查询成功。