ATS调用含nickname存储过程出错的解决方法

57次阅读
没有评论

共计 4398 个字符,预计需要花费 11 分钟才能阅读完成。

本篇文章为大家展示了 ATS 调用含 nickname 存储过程出错的解决方法,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

问题描述:
客户这边的 db2 版本为 V10.5, 跑在 Linux 上。通过联邦数据库的 nickname 连接了了一个 oracle 数据库,oracle 的版本为 11.2。客户开发了一个存储过程抓取 oracle 数据库的数据,手工跑存储过程(db2 call ***)没有任何问题,但只要用 ATS 调用就报错(创建 ATS TASK 的用户只有 dbadm 权限,不是 instance owner):
SQL30080N  A communication error NET8: 24315 occurred sending or receiving data from the remote database.  SQLSTATE=08001  POINT:0001
最后协调客户使用 instance ID 来调用此 ATS task,则没有错误。

解决过程:
– 重现错误:
[root@dba_test:/]{20170630+0 18:21:38}# useradd -g staff -d /home/shenft shenft
[root@dba_test:/]{20170630+0 18:21:38}# cd /home
[root@dba_test:/home]{20170630+0 18:21:47}# mkdir shenft
[root@dba_test:/home]{20170630+0 18:22:36}# chown shenft:staff shenft

su – nbuinst1
db2 connect to FEDORADB
[nbuinst1@dba_test:/db/dbhome/nbuinst1]{20170630+0 18:17:32}$ db2 grant connect,dbadm on database to user shenft
DB20000I  The SQL command completed successfully.

[root@dba_test:/home]{20170630+0 18:22:50}# su – shenft
[shenft@dba_test:/home/shenft]{20170630+0 18:24:07}$ vi .profile
.profile [New file]
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.
export PATH
# The following three lines have been added by IBM DB2 instance utilities.
if [-f /db/dbhome/nbuinst1/sqllib/db2profile]; then
  . /db/dbhome/nbuinst1/sqllib/db2profile
fi
– 手工调用存储过程无错误
[shenft@dba_test:/home/shenft]{20170630+0 18:28:00}$ db2 connect to FEDORADB   

  Database Connection Information

 Database server  = DB2/AIX64 10.5.5
 SQL authorization ID  = SHENFT
 Local database alias  = FEDORADB

[shenft@dba_test:/home/shenft]{20170630+0 18:28:06}$ db2 call KPI.INFO_TASK()

  Return Status = 0
 
[shenft@dba_test:/home/shenft]{20170630+0 18:32:20}$  db2 call SYSPROC.ADMIN_TASK_ADD (Shenft test , NULL, NULL, NULL, 35,38 18 * * * , KPI , INFO_TASK , NULL, NULL, NULL)

  Return Status = 0
 
[shenft@dba_test:/home/shenft]{20170630+0 18:38:01}$ db2 select * from kpi.tasklog

TASKNAME  BEGINTIME  ENDTIME  RTCODE  FIRSTTIME  SUCCNUM  FAILNUM   
——————————– ————————– ————————– ———– ————————– ——————– ——————–
CMDB.ORA_TEST  2017-06-30-18.38.00.837737 2017-06-30-18.38.01.016671  -30080 2017-06-30-18.38.00.837737  0  1

  1 record(s) selected.

[shenft@dba_test:/db/dbhome/nbuinst1/sqllib/db2dump]{20170630+0 18:42:35}$ grep -ip ORA db2diag.log
2017-06-30-18.38.01.001931+480 E2470A651  LEVEL: Error
PID  : 17498252  TID : 17872  PROC : db2sysc 0
INSTANCE: nbuinst1  NODE : 000  DB  : FEDORADB
APPHDL  : 0-34655  APPID: *N0.nbuinst1.170630103800
AUTHID  : SHENFT  HOSTNAME: dba_test
EDUID  : 17872  EDUNAME: db2agent (FEDORADB) 0
FUNCTION: DB2 UDB, net8 wrapper, Net8_Connection::error_report, probe:40
DATA #1 : String, 28 bytes
Oracle Error – Current User
DATA #2 : String with size, 6 bytes
SHENFT
DATA #3 : String, 22 bytes
Oracle Error Received
DATA #4 : String, 26 bytes
ORA-24315: …………..

2017-06-30-18.38.01.014148+480 E3122A700  LEVEL: Error
PID  : 17498252  TID : 17872  PROC : db2sysc 0
INSTANCE: nbuinst1  NODE : 000  DB  : FEDORADB
APPHDL  : 0-34655  APPID: *N0.nbuinst1.170630103800
AUTHID  : SHENFT  HOSTNAME: dba_test
EDUID  : 17872  EDUNAME: db2agent (FEDORADB) 0
FUNCTION: DB2 UDB, net8 wrapper, Net8_Connection::error_report, probe:40
DATA #1 : String, 28 bytes
Oracle Error – Current User
DATA #2 : String with size, 6 bytes
SHENFT
DATA #3 : String, 22 bytes
Oracle Error Received
DATA #4 : String, 75 bytes
ORA-03113: ………………
…. ID: 46989330
…. ID: 274 ……: 14361

2017-06-30-18.38.01.014852+480 E3823A671  LEVEL: Error
PID  : 17498252  TID : 17872  PROC : db2sysc 0
INSTANCE: nbuinst1  NODE : 000  DB  : FEDORADB
APPHDL  : 0-34655  APPID: *N0.nbuinst1.170630103800
AUTHID  : SHENFT  HOSTNAME: dba_test
EDUID  : 17872  EDUNAME: db2agent (FEDORADB) 0
FUNCTION: DB2 UDB, net8 wrapper, Net8_Connection::error_report, probe:40
DATA #1 : String, 28 bytes
Oracle Error – Current User
DATA #2 : String with size, 6 bytes
SHENFT
DATA #3 : String, 22 bytes
Oracle Error Received
DATA #4 : String, 46 bytes
ORA-24327: ………………, …………..
之后尝试了多种方法都无效,包括将 shenft 加入 instance ID 所在的组,给 shenft 创建自己的 uesr mapping, nick_name, store procedure。
我还发现一个现象,就是尽管数据库中 2 个用户各自有自己的 user mapping,我改了 oracle 端的用户密码后,只修改 shenft 的 user mapping 的密码, 则用 shenft 手工调用存储过程时没有问题,而用 ATS 调用时则报密码错误。修改了 instance ID 的 user mapping 的密码后又报回 -30080 错误。
从现象看我觉得是 ATS 的 bug,就是说尽管是别的用户创建的 ATS task,但数据库还是试图用 instance ID 的身份跑,由此造成冲突导致错误发生。

最后求助 IBM level 2,确认了这是个 bug,在 ATS 中其他用户调用 ATS task 时其实还是使用 instance ID 来执行。

IBM level 2 给出的最终解决方案,问题被 fix:
db2 alter wrapper net8 options (add DB2_FENCED N)
db2 alter server *** options (add fold_ID N ,fold_PW N)
db2 alter user mapping for *** server *** options (add use_trusted_context Y)
同时在 oracle 端用 DBA 权限跑(username 为 user mapping 中连接 oracle 数据库的用户):
ALTER USER username GRANT CONNECT THROUGH username

上述内容就是 ATS 调用含 nickname 存储过程出错的解决方法,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注丸趣 TV 行业资讯频道。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计4398字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)