共計(jì) 4398 個(gè)字符,預(yù)計(jì)需要花費(fèi) 11 分鐘才能閱讀完成。
本篇文章為大家展示了 ATS 調(diào)用含 nickname 存儲(chǔ)過程出錯(cuò)的解決方法,內(nèi)容簡(jiǎn)明扼要并且容易理解,絕對(duì)能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
問題描述:
客戶這邊的 db2 版本為 V10.5, 跑在 Linux 上。通過聯(lián)邦數(shù)據(jù)庫(kù)的 nickname 連接了了一個(gè) oracle 數(shù)據(jù)庫(kù),oracle 的版本為 11.2??蛻糸_發(fā)了一個(gè)存儲(chǔ)過程抓取 oracle 數(shù)據(jù)庫(kù)的數(shù)據(jù),手工跑存儲(chǔ)過程(db2 call ***)沒有任何問題,但只要用 ATS 調(diào)用就報(bào)錯(cuò)(創(chuàng)建 ATS TASK 的用戶只有 dbadm 權(quán)限,不是 instance owner):
SQL30080N A communication error NET8: 24315 occurred sending or receiving data from the remote database. SQLSTATE=08001 POINT:0001
最后協(xié)調(diào)客戶使用 instance ID 來調(diào)用此 ATS task,則沒有錯(cuò)誤。
解決過程:
– 重現(xiàn)錯(cuò)誤:
[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
– 手工調(diào)用存儲(chǔ)過程無錯(cuò)誤
[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 創(chuàng)建自己的 uesr mapping, nick_name, store procedure。
我還發(fā)現(xiàn)一個(gè)現(xiàn)象,就是盡管數(shù)據(jù)庫(kù)中 2 個(gè)用戶各自有自己的 user mapping,我改了 oracle 端的用戶密碼后,只修改 shenft 的 user mapping 的密碼, 則用 shenft 手工調(diào)用存儲(chǔ)過程時(shí)沒有問題,而用 ATS 調(diào)用時(shí)則報(bào)密碼錯(cuò)誤。修改了 instance ID 的 user mapping 的密碼后又報(bào)回 -30080 錯(cuò)誤。
從現(xiàn)象看我覺得是 ATS 的 bug,就是說盡管是別的用戶創(chuàng)建的 ATS task,但數(shù)據(jù)庫(kù)還是試圖用 instance ID 的身份跑,由此造成沖突導(dǎo)致錯(cuò)誤發(fā)生。
最后求助 IBM level 2,確認(rèn)了這是個(gè) bug,在 ATS 中其他用戶調(diào)用 ATS task 時(shí)其實(shí)還是使用 instance ID 來執(zhí)行。
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)
同時(shí)在 oracle 端用 DBA 權(quán)限跑(username 為 user mapping 中連接 oracle 數(shù)據(jù)庫(kù)的用戶):
ALTER USER username GRANT CONNECT THROUGH username
上述內(nèi)容就是 ATS 調(diào)用含 nickname 存儲(chǔ)過程出錯(cuò)的解決方法,你們學(xué)到知識(shí)或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識(shí)儲(chǔ)備,歡迎關(guān)注丸趣 TV 行業(yè)資訊頻道。