ORA-04068: existing state of packages has been discarded

하나.버전 정보
운영 체제 버전:
AIX 6100
데이터베이스 버전:
11.2.0.3(psu5)
 
둘.오류 설명
# 이 오류는 여러 가지 이유가 있기 때문에 여기서 장면을 설명할 때 상세히 설명해야 한다
이 오류는 oracle "Doc ID 1413756.1"에서 설명한 오류를 해결할 때 발생합니다.(구체적으로 내 앞 블로그를 볼 수 있다)
1. Doc ID 1413756.1에서 제공한 임시 해결 방안에 따라 나는 각각 다음과 같은 명령을 집행했다
-- Login as sys user.
 
SQL> sqlplus / as sysdba
 
-- From the sqlplus execute the following:
 
-- Drop the DBSNMP user by executing catnsnmp.sql script.
 
SQL> @$ORACLE_HOME/rdbms/admin/catnsnmp.sql
 
-- Create the DBSNMP user by executing catsnmp.sql
 
SQL> @$ORACLE_HOME/rdbms/admin/catsnmp.sql

# 타임즈 삭제 - 역할이 존재하지 않으며 일부 object가 저장된 타임즈를 재구성합니다.큰 문제는 없습니다.
2. 문제가 없는지 확인하기 위해 DBSNMP 사용자를 삭제하고 재구성하는 명령을 다시 반복했습니다. (같은 세션에서)
# 사용자를 삭제할 때는 첫 번째 실행과 일치하지만 사용자를 재구성할 때는 다음과 같은 오류 메시지가 표시됩니다.
Package body created.


Package body created.

declare
*
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package "DBSNMP.BSLN" has been invalidated
ORA-04065: not executed, altered or dropped package "DBSNMP.BSLN"
ORA-06508: PL/SQL: could not find program unit being called: "DBSNMP.BSLN"
ORA-06512: at line 18

PL/SQL procedure successfully completed.

# 오보에서 사실 우리는 이미 일부 실마리를 알 수 있다. 오보로 패키지의state(설명)가 이미 무효라고 말하고 뒤의 오류를 초래했다.
 
셋.오류 원인 및 해결 방안
우리의 오랜 조력자인 MOS를 찾아보니'Doc ID 1161225.1'이라는 노트가 내가 겪은 문제를 설명할 수 있다는 것을 발견했다. 나는 그 중 일부를 붙였다.
When a package is compiled, altered or an object on which the package depends is altered, all copies of that package in the shared pool are flagged as invalid. 

The next invocation of the package from another database session ( even if it is the same username) sees that this flag is set and goes to get a new copy.   <span style="color:#ff0000;">If the package has package state, i.e. it has one or more package variables that would normally persist across calls to the package within the same session, then ORA-4068 error is raised to indicate to the caller that that package state (i.e the current values of those package variables)  has been lost</span>.  When the ORA-4068 is raised, ORACLE will throw away all existing instantiations of the package.  When the package (more properly, the subprogram referring to the package) is re-executed, ORACLE will re-instantiate the package automatically (If possible), which will typically succeed, and re-execution of the subprogram will succeed.
 
The mechanism is not sensitive enough to check whether the calling session actually referred to any of the package variables so you always get the error in these situations if the package you are calling has package variables defined.  <span style="color:#ff0000;">This is quite common therefore if your program calls a system level package (typically beginning DBMS_ or  UTL_)  that has been recompiled, as the majority of them have at least one package variable defined.</span>

# 대개 프로그램 패키지가 컴파일되거나 alert 또는 패키지에 의존하는 대상이 alert에 의존한다면 shared pool (여기는 shared pool 참조) 에서 이 패키지의 copies는 모두 실효 상태로 표시됩니다.
다른 세션에서 이 보고서를 다시 호출할 때 실효 표시를 발견하면 새로운copy를 가져옵니다.
만약에 이 가방에 설명이 있다면 예를 들어 이 가방이 변수를 설명했다면 우리는 같은 세션에서 이 변동된 가방을 다시 호출하면 ORA-4068이라는 오류를 보고하고 호출자에게 이 가방의 설명이 효력을 잃었다는 것을 나타낸다.DBSNMP 사용자 오류 복구를 두 번째로 수행한 이유입니다.
#이 오답은 우리가 잘못 볼 수 있는 경고이다. 우리는 처리할 필요가 없다. 다시 호출하면 문제가 없다.
 
넷.관련 지식
# 업무 중에 발생한 상황만 나열하고 일부 다른 상황은 이 보고를 틀리게 할 수 있다
"Doc ID 106206.1"에서 흔히 볼 수 있는 장면을 열거하였으며, MOS에서 이 오답을 직접 검색하여 자신의 문제에 부합되는 note를 볼 수 있습니다.
 
 

좋은 웹페이지 즐겨찾기