您好,登錄后才能下訂單哦!
本篇文章為大家展示了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存儲過程出錯的解決方法,你們學到知識或技能了嗎?如果還想學到更多技能或者豐富自己的知識儲備,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。