【DB2】How to resolve SQL20249N the statement was not processed with error

相关链接

https://vinaysdb2blog.blogspot.com/2017/11/how-to-resolve-sql20249n-statement-was-not-processed-error.html

转载

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 : db2syscINSTANCE: db2inst1 NODE : 000 DB : SAMPLEAPPHDL : 0-10 APPID: LOCAL.db2inst1.170421085044AUTHID : DB2INST1 HOSTNAME: testserverEDUID : 582 EDUNAME: db2agent (SAMPLE)FUNCTION: DB2 UDB, catalog services, sqlrlGetVersionTimes, probe:180MESSAGE : 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.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值