首页 > 数据库DBA > oracle知识 > oracle报错 >
ORA-00600: 内部错误代码, 参数: [kkqcscpopn_Int: 0]和参数_optimizer_cost_based_transformation
一个报表 查询的时候报错
SELECT count(1) total,
sum(s.AVAIQTY) stocks,
sum(s.STOCKQTY) totalStocks,
sum(s.LOCKQTY) lockStocks,
sum(s.TRANSITQTY) transitStocks,
sum(s.stockqty * fn_getgoodsdpprice_epos(s.CHANNELID,s.goodsid)) dpAmount
FROM VIEWGOODSSTOK_UPRIGHT s
LEFT JOIN CHANNEL c ON c.CHANNELID = s.CHANNELID
LEFT JOIN GOODS g ON g.GOODSID = s.GOODSID
LEFT JOIN SIZECATEGORY sc ON sc.SIZECATEGORYID = g.SIZECATEGORYID AND s.sizes = sc.FILEDNAME
LEFT JOIN (select goodsId, colorId, longId, SizeId, max(barcode) barcode from GOODSBARCODE group by goodsId, colorId, longId, SizeId) gb
ON gb.GOODSID = s.GOODSID AND gb.COLORID = s.COLORID AND gb.LONGID = s.LONGID AND gb.SIZEID = sc.id
LEFT JOIN (select goodsId, colorId, longId, SizeId, max(uniqueCode) uniqueCode , channelid from uniquelist group by goodsId, colorId, longId, SizeId, channelId) gu
ON gu.GOODSID = s.GOODSID AND gu.COLORID = s.COLORID AND gu.LONGID = s.LONGID AND gu.SIZEID = sc.id and gu.channelid = s.CHANNELID
WHERE g.status=1
AND s.CHANNELID in
(
'6576767ACF0045AE8AD201B0092CF8ED'
)
–执行后会提示 ORA-00600: 内部错误代码, 参数: [kkqcscpopn_Int: 0], [], [], [], [], [], [], [], [], [], [], []
解决办法:
调整oracle参数_optimizer_cost_based_transformation可以在session和system级别修改,
默认值’linear’,默认通过成本值比较来转换sql,改为‘OFF’,则不管成本值都会进行复杂视图合并。
alter system set "_optimizer_cost_based_transformation"=off
按查到的 这个参数值的 理解 通过查询转换前后的成本值来决定是否转换,
估计就是嵌套比较多 视图有点复杂 可能会比较耗费资源 默认情况下这个参数没有开 执行的时候预判比较耗费资源就报错了,开启参数后 不管资源消耗都强制执行 就没有提示了。
方法的不足之处:这个参数开启后,对服务器CPU压力比较大,不建议用参数解决
一台平常cpu使用率在30%的服务器,开启后直接就飙升到77%,所以建议优化SQL解决,不建议用参数解决