728x90
 

Question

I found some indexes marked invalid after rollforward, or a HADR standby database become switched to primary.
Why the indexes are marked as invalid, and how I can recover the invalid indexes.

Cause

Db2 does not write index build or rebuild log records by default, rather Db2 marks the index as invalid so that recovery task can trigger to rebuild the index.

Answer

"Index rebuilding" means index creation, index reorg, classic table reorg, and rebuilding index in this article.
 
Indexes can be marked as invalid when:
  • Index rebuilding is not logged ( LOGINDEXBUILD=NO), then index rebuilding replayed.
  • Index rebuilding is logged ( LOGINDEXBUILD=YES), then index rebuilding replayed but INDEXREC is set as ACCESS_NO_REDO or RESTART_NO_REDO.
  • Failed offline reorg, or such failed offline reorg is replayed.
  • db2dart runs with /MI option.

Indexes can be rebuilt when:
  • There are one or more indexes marked invalid when a database restarts. i,e. Run RESTART DB with INDEXREC=RESTART
  • Someone access an index marked as invalid.
  • Run classic REORG TABLE command
  • Run REORG INDEXES or REORG INDEX command
  • Run CREATE INDEX statement
  • Run LOAD command, and it uses REBUILD option as INDEXING MODE
  • Run IMPORT or LOAD command with REPLACE option
  • Run TRAUNCATE TABLE statement

We can list all the indexes marked as invalid by the following query:
db2 "select tabschema, tabname, indname, datapartitionid, index_partitioning from table(sysproc.admin_get_index_info('','','')) as t where index_requires_rebuild='Y'"

We can recover the indexes marked as invalid by ether of the following ways.
 
a) Run RESTART DATABASE command (in case db cfg INDEXREC is set as RESTART)
The restart database command rebuild all the indexes set as INDEX_REQUIRES_REBUILD=Y
db2 restart database <database_name>
b) Run reorg indexes
db2 reorg indexes all on table <table_name> allow no access

Note: 
You can set LOGINDEXBUILD as YES to prevent indexes to be marked as invalid.
So, this setting is highly recommended in HADR databases.
Example:
db2 connect to <database_name>
db2 update db cfg using LOGINDEXBUILD YES

 

https://www.ibm.com/support/pages/db2-causes-mark-index-invalid-and-how-recover-indexes

 

[Db2] The causes to mark index invalid, and how to recover the indexes.

[Db2] The causes to mark index invalid, and how to recover the indexes.

www.ibm.com

 

728x90
728x90

데이터베이스 마이그레이션, 리스토어(RESTORE) 작업으로 인해 루틴이 INVALID 상태로 빠지는 경우가 있습니다. 아래에서 설명하는 sysproc.admin_revalidate_db_objects 프로시저를 사용해 오브젝트 별 또는 일괄로 루틴들을 재컴파일 할 수 있습니다.


Question

DB2 Package could be revalidated by either the REBIND or the BIND command, however it may not work for SQL routines, how to mark a routine to be VALID?

Cause

For some reasons, some packages or routines may be marked as INVALID. For package which is invalid, it will allow revalidation to occur implicitly when the package is first used, or to occur explicitly by either the REBIND or the BIND command.
The rebind_rouine_package function will rebind the package associate with the SQL procedure, it will mark the related package itself VALID as well.
-> 해당 루틴이 VALID인지는 syscat.routines 카탈로그 테이블을 참조하면 됩니다. 'N'이면 INVALID 상태입니다.

However it is not the case for routine, it could not mark the routine VALID by REBIND, BIND command, and the rebind_rouine_package function.


Answer

As REBIND validate the package only, for routine to be VALID, it needs to revalidate it implicitly by accessing it, or call function such as admin_revalidate_db_objects explicitly.


For example: call sysproc.admin_revalidate_db_objects('PROCEDURE','MY_SCHEMA','MY_PROCEDURE')
-> 특정 프로시저나 함수이름을 지정할 수 있고, 특정 스키마에 대한 일괄 수행을 하려면 NULL을 씁니다.

It is different to revalidate objects that are inside of a module,
If the routine is within one module, it needs to use the MODULE type with the name of a specific module in ADMIN_REVALIDATE_DB_OBJECTS call,
and all of the invalid objects include routines inside of that module will be revalidated.

Such as the routine SYSIBMADM.WRITE_BLOB could NOT be revalidated by:
call sysproc.admin_revalidate_db_objects('PROCEDURE','SYSIBMADM','WRITE_BLOB').

Instead, as it belongs to UTL_MAIL module, it needs to be revalidated by:
call sysproc.admin_revalidate_db_objects('MODULE','SYSIBMADM','UTL_MAIL').


https://www-01.ibm.com/support/docview.wss?uid=swg21472742

728x90
728x90

# EILSEQ_COMPAT_MODE:
# When processing characters, IDS checks if the characters are valid
# for the locale and returns error -202 if they are not. This causes
# problems in some applications. This parameter preserves the old
# behavior and permits these characters.
# 0 => Disallow illegal characters. This is the default behavior.
# 1 => Allow illegal characters.
#

IDS 10.00.xC4 이상에서 문자 검사가 엄격하게 되었기 때문에, 잘못된 문자가 포함된 데이터(문자열 값)의 처리에서 오류가 발생합니다.

그러나 기존 응용 프로그램의 운영에 지장을 줄 수 있기 때문에, IDS 10.00.xC7에서 이전 버전처럼 동작 모드 (문자열 값 무단 문자를 확인하지 않음)을 지정하기위한 매개 변수 EILSEQ_COMPAT_MODE가 신설되었습니다.
그러나 잘못된 문자에 의한 영향에 대해서는 자기 책임입니다.


http://oninit.ti-da.net/e2452099.html

http://ilovedb.byus.net/zboard/view.php?id=ifx_qna&page=2&sn1=&divpage=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=329

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

728x90

+ Recent posts