728x90

Technote (troubleshooting)


Problem(Abstract)

You are trying to drop or disable a trigger but such operation fails with following errors:

242: Could not open database table <table_name>

106: ISAM error: non-exclusive access

Symptom

You have trapped error -106 using 'onmode -I 106' but in the gathered output of 'onstat -k' you do not see any locks on the table for which the error was returned.


Cause

Certain DDL operations require exclusive lock placed on a table. The corresponding session also checks if the table's partition is not used by any other sessions in DIRTY READ mode.

Resolving the problem

There are two possible workarounds for this problem:

1) Use LOCK MODE WAIT for the session which runs the DDL statement.

2) Use undocumented $ONCONFIG parameter & environment variable NONEXCLTRIG.

You can set NONEXCLTRIG to the following values in $ONCONFIG file (engine restart is required so change could take effect):


    NONEXCLTRIG values can be:

    0 - Normal behaviour (exclusive lock is required)
    1 - the trigger DDL can be done without exclusive access to table, only if NONEXCLTRIG environment variable is defined in the session environment.
    2 - the trigger DDL can be done without exclusive access to table.


http://www-01.ibm.com/support/docview.wss?uid=swg21648816

728x90
728x90

SQL0727N 오류는 여러가지 원인으로 발생하는데 그중 하나의 예를 소개합니다.


1. 현상 : 테이블에 데이터 입력하는 프로시저 호출 불가

2. 원인 : 해당 테이블(또는 뷰에서 바라보는 테이블)의 트리거 inoperative 상태


테이블의 트리거가 inoperative 상태로 빠지면, 해당 테이블에 대해서 DML(INSERT, DELETE, UPDATE) 이 작동하지 않게됩니다.

아래와 같이 syscat.systrigger 테이블의 VALID 컬럼이 Y가 아닌 상태의 트리거가 있는지 확인합니다.


$ db2 "select substr(trigname,1,20) trigname,valid from syscat.triggers where valid <> 'Y'"


TRIGNAME             VALID

-------------------- -----

NEW_HIRED            N


이 상황에서 INSERT (DELETE, UPDATE) 를 실행하면 아래와 같이 오류가 발생합니다.

$ db2 "update employee set lastname='JEONG' where empno=200340"
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0727N  An error occurred during implicit system action type "3".
Information returned for the error includes SQLCODE "-204", SQLSTATE "42704"
and message tokens "DB2I105.COMPANY_STAT".  LINE NUMBER=2.  SQLSTATE=56098



참고사항)

이런 상태의 트리거는 CREATE TRIGGER문으로 작성하면 아래와 같이 Warning 메시지가 발생하면서 기존의 TRIGGER가 대체됩니다.


SQL0280W  View, trigger or materialized query table "DB2I105.NEW_HIRED" has

replaced an existing inoperative view, trigger or materialized query table.

SQLSTATE=01595


이에 대해서는 IBM Knowledge Center에도 나와있습니다.

An inoperative trigger may be recreated by issuing a CREATE TRIGGER statement using the definition text of the inoperative trigger. This trigger definition text is stored in the TEXT column of the SYSCAT.TRIGGERS catalog view. Note that there is no need to explicitly drop the inoperative trigger in order to recreate it. Issuing a CREATE TRIGGER statement with the same trigger-name as an inoperative trigger will cause that inoperative trigger to be replaced with a warning (SQLSTATE 01595).
 
Inoperative triggers are indicated by an X in the VALID column of the SYSCAT.TRIGGERS catalog view.

뷰, 트리거 등의 오브젝트 상태도 주기적으로 체크하면 좋을 것 같습니다.


https://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.sql.ref.doc/doc/r0000931.html


728x90

+ Recent posts