包没问题啊,我看有人是这样解释的,但是还是解决不了问题啊,杀session也会影响其他业务啊,而且我试了好像没效果,不知道是不是没杀正确
一、
1. 楼主新打开一个session去执行就没有该问题了
2. 因为在A会话修改包并重复编译的时候之前,B会话已经执行过一次A会话的包中的函数,而A会话修改和编译完毕后,B会话再次调用A会话中的包中的函数,oracle发现缓存区中的包的函数已经是旧的了,所以返回提示信息:
ORA-04068: 已丢弃程序包 的当前状态
ORA-04061: package body "DB2INST2.PKGTEST " 的当前状态失效
ORA-04065: 未执行, 已更改或删除 package body "DB2INST2.PKGTEST " -- 注意“已更改”
然后删除了缓存中的包pkgtest的函数
再次执行的时候,重新读取函数,就不会存在该问题
如果重新打开一个session的去执行的话,也不会存在该问题
二、
This message was send by oracle via the jdbc driver, not weblogic. Weblogic just reutter the error message to you.The same situation exists in prepare statement. i.e, in your app, first you prepare a statement that select a table's content, it will succeed without error, then you drop the table manually, last you call the prepared statement again, you certainly will get the same error.I think the error lies in that, no matter package,procedure,prepare statement, Oracle parse them and store the parsed version in some Cache memory, and when the cached version was nolonger valid, then oracle throws an error to you.But if you reconnect to database, the cache (your own session cache now empty) will get recached by valid content, then oracle will not throw the same error, in the former example, it will throw an error state that the table was not exist.So, an ugly solution will be cheat weblogic by manully drop all user session made by weblogic in oracle's management console or in sqlplus. But this will cause your app throw errors also. But catch sql exception was commont part of all jdbc application, so, it will be properly handled or probably proper handled.And last, if you recompile your procedure, you are on a development server, isn't it? So, it does not matter what ever you will restart...