ORA-4065錯誤處理過程筆記
接渠道反饋,某使用者在進行軟體操作的時候提示‘ORA-4065未執行,已變更或刪除預存程序 Zl_XXXX_Finish’,使用者嘗試重新編譯下這個過程,又可以使用,但是一段時間後又會提示該錯誤,使用者希望徹底解決。
問題分析步驟一:查看錯誤碼官方解釋
如果有錯誤資訊(ORA錯誤碼),我們肯定首先看下這個錯誤的官方解釋,如下:
Error description:
Error: ORA 4065
Text: not executed, altered or dropped %s
-------------------------------------------------------------------------------
Cause: Attempt to execute a stored procedure that has been altered or droppedthus making it not callable from the
calling procedure.
Action: Recompile its dependents.
Error: ORA 4068
Text: existing state of packages%s%s%s has been discarded
-------------------------------------------------------------------------------
Cause: One of errors 4060 - 4067 when attempt to execute a stored procedure.
Action: Try again after proper re-initialization of any application's state.
可以看到,錯誤解釋裡面已經提到重新編譯下就能夠解決,但是顯然這種解決方式並不能夠徹底的處理這個問題,我們需要更進一步的尋找錯誤的處理方法。
步驟二:尋找官方文檔
隨後查詢官方文檔,找到一篇流程說明比較接近的內容,Summary of Causes for ORA-4068 and ORA-4065 in10gR2,其中給出了另外一種導致該錯誤的原因如下,關鍵內容如下:
Bug 6136074 ORA-4068 ORA-4065 ORA-06508 ERRORS SIGNALED FOR VALID OBJECTS
Component: RDBMS
Fixed Ver(s): 10204 111
Symptom(s):
Recompilation of a view might lead to inconsistent timestamps for some of theview's PLSQL dependents. The script in
Note 136697.1can be used to check for such problem DEPENDENCY$ entries, or use the SQLbelow:
set pagesize 10000
column d_name format a20
column p_name format a20
select do.obj# d_obj,do.name d_name, do.type# d_type,
po.obj# p_obj,po.name p_name,
to_char(p_timestamp,'DD-MON-YYYY HH24:MI:SS') "P_Timestamp",
to_char(po.stime ,'DD-MON-YYYY HH24:MI:SS') "STIME",
decode(sign(po.stime-p_timestamp),0,'SAME','*DIFFER*') X
from sys.obj$ do, sys.dependency$ d, sys.obj$ po
where P_OBJ#=po.obj#(+)
and D_OBJ#=do.obj#
and do.status=1 /*dependent is valid*/
and po.status=1 /*parent is valid*/
and po.stime!=p_timestamp /*parent timestamp not match*/
order by 2,1;
上門的文檔內容說,這個問題還可能是bug6136074引起,通過給出的查詢語句,可以查詢到過程時間戳記不一致的情況,一般情況下,通過重新編譯過程,能夠使時間戳記一致,但是有時候光編譯還不能起到效果,這時候,就必須刪除重建的方式,這裡要看是什麼對象,我們這裡查出來是公用同義字,就只需要刪除同義字重建就可以。
解決過程
通過官方給出的SQL查詢是Zl_病人醫囑執行_Finish的公用同義字時間戳記不一致,我們這裡刪除這個過程的公用同義字,然後重建,完成本次問題的處理。
注意刪除同義字的時候,告知使用者可能引起暫時的無法使用。
Linux-6-64下安裝Oracle 12C筆記
在CentOS 6.4下安裝Oracle 11gR2(x64)
Oracle 11gR2 在VMWare虛擬機器中安裝步驟
Debian 下 安裝 Oracle 11g XE R2