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

오라클 호환모드가 설정되어 있는 데이터베이스에서 트리거 생성시 오류가 발생하는 케이스에 대해 소개합니다.

DB2 인스턴스 계정에서 db2set 명령으로 오라클 호환모드 설정내역을 확인합니다.


$ db2set -all

[i] DB2_COMPATIBILITY_VECTOR=ORA

[i] DB2_SKIPINSERTED=on

[i] DB2_OPTPROFILE=yes

[i] DB2_EVALUNCOMMITTED=yes

[i] DB2_SKIPDELETED=on

[i] DB2DBDFT=hansdb

[i] DB2COMM=TCPIP

[i] DB2AUTOSTART=NO



$ db2 "create table test (aa int, id char(20))"
DB20000I  The SQL command completed successfully.
$ db2 "create table test_his (aa int, id char(20))"
DB20000I  The SQL command completed successfully.

아래는 트리거 내용입니다.

$ cat create_trigger.sql
   CREATE OR REPLACE TRIGGER TRI1 NO CASCADE AFTER INSERT on TEST
      REFERENCING NEW AS N
      FOR EACH ROW
      BEGIN
             INSERT INTO TEST_HIS (aa,id) VALUES (N.aa, N.id);
      END
!

트리거를 생성하려고 하면 아래와 같이 SQL0206N 오류가 발생합니다.

$ db2 -td! -f create_trigger.sql
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0206N  "N.AA" is not valid in the context where it is used.  LINE NUMBER=5.
SQLSTATE=42703

오류 원인은 오라클 호환모드로 인한 것으로, 오라클 호환모드에서 위와 같이 TRIGGER 생성 구문을 사용하면 우선적으로 오라클 스타일로 해석되는 것 같습니다.
따라서 DB2 스타일로 인식되도록 FOR EACH ROW를 FOR EACH ROW MODE DB2SQL 로 바꿔줍니다.

CREATE TRIGGER TRI1 AFTER INSERT on TEST
      REFERENCING NEW AS N
      FOR EACH ROW MODE DB2SQL
      BEGIN
             INSERT INTO TEST_HIS VALUES (N.aa, N.id);--
      END
!


http://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.sql.ref.doc/doc/r0000931.html


728x90
728x90

OS: CentOS 6.6

DBMS: IBM DB2 9.1.0.5


위의 환경에서 데이터베이스를 생성하고 JDBC 클라이언트 및 로컬에서 특정 사용자로 접속시도하면 오류가 발생했습니다.

지원되지 않는 패스워드 알고리즘으로 패스워드를 생성한 것이 원인이었습니다.


db2 커맨드로 접속시 발생한 오류

$ db2 connect to dbname user ??? using ???

SQL30082N  Security processing failed with reason "15" ("PROCESSING FAILURE").

SQLSTATE=08001


자바(jdbc)를 통한 연결 오류

com.ibm.db2.jcc.am.SqlInvalidAuthorizationSpecException: [jcc][t4][2010][11246][4.16.53] Connection authorization failure occurred.  Reason: Local security service non-retryable error. ERRORCODE=-4214, SQLSTATE=28000


아래와 같이 authconfig를 사용하여 현재 설정된 패스워드 알고리즘 방식을 확인합니다.

CentOS 6.6에서는 기본이 sha512 알고리즘을 사용하는 모양입니다.


# authconfig --test | grep password

 shadow passwords are enabled

 password hashing algorithm is sha512 


아래와 같이 authconfig를 사용하여 현재 설정된 패스워드 알고리즘 방식을 확인합니다.

CentOS 6.6에서는 기본으로 sha512 알고리즘을 사용하는 모양입니다. DB2 9.1에서는 Crypt, MD5. SHA1 알고리즘만 지원한다고 합니다.

따라서 아래와 같이 설정하고 DB2 사용자 패스워드 재설정한 후에는 접속이 잘 이루어졌습니다.


# authconfig --passalgo=md5 --update


아래는 해당 내용에 대한 IBM문서입니다. 참고하시기 바랍니다.


SQL30082 RC=24 or RC=15 returned when connecting to database on Server when pwd_algorithm is Crypt, MD5, SHA1, SHA256, SHA512, Blowfish

Problem(Abstract)

A local or remote connection to a database using:

db2 connect to sample user <userid> using <password>

returns

SQL30082N Security processing failed with reason "24" ("USERNAME AND/OR 
PASSWORD INVALID"). SQLSTATE=08001 

The error in db2diag.log is 
2011-01-01-17.21.43.367890-300 I1011620A272 LEVEL: Warning 
PID : 123456 TID : 1 
FUNCTION: DB2 Common, Security, Users and Groups, secLogMessage, probe:
20 
DATA #1 : String, 66 bytes 
Password validation for user db2inst1 failed with rc = -2146500507 

OR 

SQL30082N Security processing failed with Reason Code 15
"Security processing at the server failed " 

2011-10-19-14.05.06.682505-300 I2778202A437 LEVEL: Warning 
PID : 10813678 TID : 6958 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : CMDB 
APPHDL : 0-117 
EDUID : 6958 EDUNAME: db2agent (CMDB) 0 
FUNCTION: DB2 UDB, bsu security, sqlexLogPluginMessage, probe:20 
DATA #1 : String with size, 67 bytes 
Password validation for user testuser failed with rc = -2029059891

Symptom

No connections can be made to the database when userid and password are provided. These connections fail with SQL30082N with Reason "24" or "15" returned.


Cause

DB2 Version 9.1 and Version 9.5 up to Fixpack 3 support the following encryption algorithms.

Crypt 
MD5 
SHA1

From DB2 Version 9.5 Fixpak 4 and versions beyond, the following algorithms are supported:

Crypt 
MD5 
SHA1 
SHA256 
SHA512 
Blowfish

For example, on AIX this is coded in the /etc/security/login.cfg file.

The error is received if you use the unsupported encryption algorithm and may show up in the db2diag log like this: 

2011-10-19-14.05.06.682321-300 I2777674A527 LEVEL: Severe
PID : 9633910 TID : 258 PROC : db2ckpwd 0
INSTANCE: db2inst1 NODE : 000
EDUID : 258 EDUNAME: db2sysc 0
FUNCTION: DB2 UDB, oper system services, sqloGetUserAttribByName, probe:50
MESSAGE : Unsupported password encryption algorithm in use! Configure the 
Operating System to use a supported algorithm.
DATA #1 : Hexdump, 4 bytes
0x07000000003F7F00 : 870F 00CD .... 

To check what encryption algorithm is being used the login.cfg file will contain something like:

usw:
shells = /bin/sh,/bin/bsh,/bin/csh,/bin/ksh,/bin/tsh,/bin/ksh93,/usr/bin
/sh,/usr/bin/bsh,/usr/bin/csh,/usr/bin/ksh,/usr/bin/tsh,/usr/bin/ksh93,/usr/sbin
/sliplogin,/usr/sbin/uucp/uucico,/usr/sbin/snappd,/bin/false
maxlogins = 32767
logintimeout = 60
pwd_algorithm = sha256
auth_type = STD_AUTH

OR the passwd.txt file will show something like this: 

root:
password = {sha256}06$SBysqAi4UQQ1nxC3$L55aKwmscvwxnKskkVrMk0HddbJyNkoE
v6HNXoLO.kH


Environment

ALL

Resolving the problem

Please use one of the supported encryption algorithms based on the version of DB2 that is being used.



http://m.blog.naver.com/june0313/50163164703

https://www-304.ibm.com/support/docview.wss?uid=swg21470246

https://www-304.ibm.com/support/docview.wss?uid=swg21416382

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


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
728x90

Technote (troubleshooting)


Problem(Abstract)

SQL0805N error, Package.Nullid.SYSLH203 was not found. SQLSTATE=51002, returned when attempting to perform a DML statement on the database server from a remote client application.

Cause

The package, SYSLH203, doesn't exist on the database server.

Resolving the problem

Depending on the type of statement you are executing, DB2 will use a particular package on the server. By default, DB2 creates three packages for each type of package. In this case NULLID.SYSLH2yy is reserved for statements with CURSORHOLD on and isolation level Cursor Stability. The package SYSLH203 means that DB2 is looking for the 4th package (200 is first, 201 is second, etc) of this type, but it does not exist. You can create more packages on the server by connecting to the database and issuing the following bind command from the /sqllib/bnd directory:

db2 bind @db2cli.lst blocking all grant public sqlerror continue CLIPKG 5

Note: CLIPKG 5 will create 5 large packages, and will give you the package that your application is looking for, as well as one more in this case.



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

728x90
728x90

DB2에서 오라클 호환모드를 사용할 때, PL/SQL에서 오라클 방식으로 VARCHAR ARRAY ( VARRAY )  타입의 데이터를 오라클 스타일로 초기화할 때 발생하는 오류에 대한 해결방법입니다. DB2에서 VARRAY 데이터 타입을 오라클 스타일로 초기화하려고 하면 함수로 인식해 SQL0440N 오류가 발생합니다.


Problem(Abstract)

A PL/SQL array constructor statement with the syntax as seen below, fails in DB2 with error SQL0440N 

For e.g.
v_List va1.t_Strings := va1.t_Strings('Harry', 'Ron', 'Hermione');
SQL0440N No authorized routine named routine-name of type routine-type having compatible arguments was found

Symptom

Error SQL0440N will be returned when a PL/SQL containing an array constructor is run in DB2.


Cause

DB2 does not support PL/SQL array constructor syntax, and therefore ends up trying to interpret the array constructor as a function call(routine).
However since it does not find a matching routine name corresponding to this, it ends up throwing the SQL0440N error.

Diagnosing the problem

If SQL0440N is returned when the PL/SQL statement is executed, then this issue can be confirmed by examining the PL/SQL to see if it uses an array constructor to initialize an array.

Resolving the problem

Workaround : 
Instead of using an array constructor to initialize the array, ie. instead of doing : 
v_List va1.t_Strings := va1.t_Strings('Harry', 'Ron', 'Hermione');

we can initialize the array as follows : 
v_List(1) := 'Harry';
v_List(2) := 'Ron';
v_List(3) := 'Hermione';


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

728x90
728x90

Problem(Abstract)

Creation of a new instance, by using 'db2icrt' command fails with,

DBI1295E The instance list could not be updated.

Symptom

'db2icrt' is being executed with the ROOT privileges.

'db2icrt' calls 'db2iset' to add the instance to the global registry. This fails, as can be seen in from the debug traces,


+ /db2test/software/ibm/db2/V10.1/instance/db2iset -a db2inst1
+ [ 255 -ne 0 ]
+ display_msg
/db2test/software/ibm/db2/V10.1/msg/en_US.iso88591/db2install.cat 295
DBI1295E The instance list could not updated.



Diagnosing the problem

If LD_LIBRARY_PATH is set in the '.profile' file of the ROOT user, it can be commented out, and 'db2icrt' should be executed again.



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

728x90
728x90

시스템

AIX 7100-02-02-1316 , "DB2 v10.5.0.3", "s140203"

AIX 7100-02-05-1415 , "DB2 v10.5.0.4", "special_32990


환경변수

(locale 관)

LANG=ko_KR.UTF-8

LC_COLLATE="ko_KR.UTF-8"

LC_CTYPE="ko_KR.UTF-8"

LC_MONETARY="ko_KR.UTF-8"

LC_NUMERIC="ko_KR.UTF-8"

LC_TIME="ko_KR.UTF-8"

LC_MESSAGES="ko_KR.UTF-8"

LC_ALL=


(terminal 관련)

TERM=xterm



위와 같은 환경에서 db2top을 실행했을 때 화면이 어그러지는 현상이 발생합니다.

환경변수 LANG을 en_US으로, TERM을 xterm, dtterm 등으로 설정했을 때 정상적으로 표시되었습니다.


IBM APAR에는 9.5버전에 대한 이슈만 나와있는데 10.5에서도 마찬가지인 것으로 보입니다.



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

http://db2commerce.com/2014/07/01/scrambled-output-from-db2top/

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

728x90
728x90


Technote (troubleshooting)


Problem(Abstract)

While installing DB2 for Windows on or prior to 10.5 Fix Pack 3, 10.1 Fix Pack 3 and 9.7 Fix Pack 9 on Windows 8.1 and Windows 2012 R2, you might receive GUI related errors, errors related to shortcuts created during the installation, and errors pertaining to the db2prereqcheck tool.

Symptom

One of the following three error symptoms might be encountered during installation on Windows 8.1 & Windows 2012 R2.

1. GUI mode of Domain installation might fail with the "Windows installer has stopped working" error on "Select the installation type" Dialog.


2. GUI mode of Fix Pack update installation may fail with the following error:


3. Shortcuts created under All Apps for the default DB2 copy do not start on invocation immediately after installation.

4. With DB2 V10.1, the db2prereqcheck tool reports Windows 8.1 and Windows 2012 R2 as not supported platform:

Checking DB2 prerequisites for DB2 database version "10.1.0.3" on operating system "Windows"
OS is Windows "Server"
ERROR: Requirement not matched.
Requirement not matched for DB2 database "Server" . Version: "10.1.0.3".
Summary of prerequisites that are not met on the current system:
Requirement not matched for DB2 database "Server" . Version: "10.1.0.3".


Environment

Windows 8.1, Windows 2012 R2


Resolving the problem

For the currently available fix packs, choose the silent installation method using response files in the following scenarios as we do not have fully enabled GUI installs yet. This helps avoid the first two errors listed in the symptom section:
1. Domain installation
2. Fix Pack update installation

Further instructions on performing a silent installation using response files can be found in the "Related information" section below.

Also, if the shortcuts created under the All Apps directory for the DB2 copy do not start on invocation after the installation of DB2 for Windows either through the GUI or silent installation, log off and log back on again.

The db2prereqcheck tool reports Windows 8.1 and Windows 2012 R2 as not supported platforms for DB2.

These possible issues will be resolved in a future fix pack


728x90
728x90

Technote (troubleshooting)


Problem(Abstract)

When adding a security member for permissions or capabilities object, getting the error:
message CM-SYS-5092 

Symptom

CM-SYS-5092 
[jcc][10429][12554][3.63.75] A processing error occurred on the server
which resulted in an unrecoverable error. Please set deferPrepares
property to false and re-establish the connection. If the problem still
persists, please contact support. ERRORCODE=-4225, SQLSTATE=24514


Cause

DB2 issue with jdbc driver (type 4)

Environment

Content Store on database , server DB2 v9.7 FP5 (jdbc type 4)

Diagnosing the problem

In logs diagnose the error message ERRORCODE=-4225, SQLSTATE=24514
deferPrepares' is a DB2 property,
Please see the link below for more detail:
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/c0010273.htm
DB2 Technote : http://www-01.ibm.com/support/docview.wss?uid=swg21168955

Resolving the problem

Set deferPrepares property to false and re-establish the connection. 
If the problem still persists, please contact DB2 support.



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

728x90

+ Recent posts