【DB2】How to resolve SQL20249N the statement was not processed with error
2018-12-05 21:09 Ivan的一亩三分地 阅读(2114) 评论(0) 编辑 收藏 举报相关链接
转载
https://www-01.ibm.com/support/docview.wss?uid=swg22002381
Technote (troubleshooting)
Problem(Abstract)
In this scenario you perform a restore of a database from a backup image. When the restore completes you receive the error SQL20249N running commands on the database.
Symptom
You are restoring from a database backup image with a higher Fix Pack number than the instance it is being restored to, as shown by the example db2diag.log below.
2017-04-21-12.50.46.077587-240 I235453E572 LEVEL: Severe*
PID : 15273 TID : 46914280089920 PROC : db2sysc
INSTANCE: db2inst1 NODE : 000 DB : SAMPLE
APPHDL : 0-10 APPID: LOCAL.db2inst1.170421085044
AUTHID : DB2INST1 HOSTNAME: testserver
EDUID : 582 EDUNAME: db2agent (SAMPLE)
FUNCTION: DB2 UDB, catalog services, sqlrlGetVersionTimes, probe:180
MESSAGE : Database release: 10050700 ==> Database is now moved back to the
current DB2 release level of 10050600
When running the query below...
db2 "select varchar(pkgschema,16),varchar(pkgname,16),valid from syscat.packages where pkgschema='NULLID' and pkgname='SQLUAK20'"
You receive the error below...
SQL20249N The statement was not processed because the package named "NULLID.SQLC2K26" needs to be explicitly rebound.
Cause
Downgrade of database to a lower Fix Pack through a restore causes packages to become invalid. Packages in a later Fix Pack may have certain differences from those in a previous Fix Pack, so if a database is downgraded, the packages are initially set as invalid, forcing the need for those invalid packages to go through the "rebind" action.
Diagnosing the problem
Check the db2diag.log after the restore to see there is an entry like the one above shown in the Symptom.
After a restore you would see error SQL20249N when trying to run commands on the database.
(See example in Symptom).
Resolving the problem
Explicitly rebind packages by performing the below commands.
db2 connect to SAMPLE
db2 rebind <package name> RESOLVE CONSERVATIVE
or
db2 -x "select 'REBIND PACKAGE ' || rtrim(pkgschema) || '.' || rtrim(pkgname) || ';' as command from syscat.packages" > rebind.sql
db2 -tvf rebind.sql
And then try the command.
db2 " select pkgschema,pkgname,valid from syscat.packages where pkgschema='NULLID' and pkgname='SQLUAK20' "
The query should work without error SQL20249N.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架