728x90

jdbc tracing 기능을 사용하는 방법을 설명하는 글입니다. 샘플 자바 코드를 첨부하였습니다.


Technote (troubleshooting)


Problem(Abstract)

How to enable JDBC tracing for debugging JDBC related issues from version 3.00.JC1 onwards.

Resolving the problem

INTRODUCTION


From version 3.00.JC1 of IBM® Informix® JDBC Driver onwards, debug drivers are no longer shipped.
Informix JDBC Driver now supports SQLIDEBUG. You no longer need to set values for TRACETRACEFILE or PROTOCOLTRACEPROTOCOLTRACEFILE. You only need to set SQLIDEBUG.

STEPS

Using a simple java program called simple.java as an example, the following steps show how to create a trace with the Informix JDBC Driver.

Example:


1. Set the CLASSPATH to the Informix JDBC Driver package.

c:\Infx\Java>set
CLASSPATH=C:\infx\JDBC3.00JC3\lib\ifxjdbc.jar;C:\infx\JDBC3.00JC3\lib\ifxjdbcx.jar;.

2. Compile simple.java

c:\Infx\Java>javac simple.java

3. Ensure that SQLIDEBUG is set correctly

c:\Infx\Java>grep SQLIDEBUG simple.java  
conn=DriverManager.getConnection("jdbc:informix-sqli://irk:1526/sysmaster:INFORMIXSERVER=irk940;USER=informix;
PASSWORD=ximrofni;SQLIDEBUG=C:\\infx\\java\\trace");

Note: SQLIDEBUG is set in the connection string. It points to where the trace file will be found with a certain format i.e. trace.xxxxxxx

4. Remove or move all other trace files

c:\Infx\Java>del trace*

5. Run java.simple

c:\Infx\Java>java simple
systables
syscolumns
...
...
oledbordinals


6. Then locate the trace file

c:\Infx\Java>dir trace*
Volume in drive C has no label.
Volume Serial Number is B823-46D8

Directory of c:\Infx\Java

04/04/2006 14:12 20,560 trace1144156355642.0
1 File(s) 20,560 bytes
0 Dir(s) 4,067,995,648 bytes free


c:\Infx\Java>

7. You will be able to see that a trace file has been created however
you will not be able to read the file.

8. Send the trace file to your local technical support office for analysis.

Note: The code simple.java is found in the attachments

simple.java



출처 : https://www-01.ibm.com/support/docview.wss?uid=swg21237681

simple.java
0.0MB
728x90
728x90

iiug.org에서 onbar에서 사용되는 XBSA API에 대한 설명을 발췌하였습니다. 

onbar 명령으로 백업을 수행하면 onbar 프로세스는 백업 솔루션의 프로세스와 통신하게 되는데, 그 과정에서 아래의 API들을 사용하게 됩니다.

onbar로 백업을 하고 계신 곳에서는 백업 로그에서 아래의 일부 API 이름을 보셨을 겁니다.


Onbar can communicate with multiple storage managers. The reason we can pull this off is because recently a standard api has been developed so that different vendors can communicate with each other. This standard/language is know as XBSA. Below are the XBSA calls that onbar uses in order to backup and restore dbspaces to/from the online engine. The functions below are the complete set of XBSA call. It is mearly the calls that onbar uses.


  • BSABeginTxn()- starts an XBSA API transaction.
  • BSACreateObject()- Creates an XBSA object. This basically tells that storage manager to make room for a new backup. The storage manager passes back the copyid (inside the objectdescriptor) that is the unique identifier that onbar uses when it need to get that back/object.
  • BSAEndData()-Tells the storage manager that there is no more data to send. (we are finished sending data associated with that particular object)
  • BSAEndTxn()- Tell the storage manager that we are finished with a backup transaction.
  • BSAGetData()- This function returns a single buffer of data from that storage manager. We pass it the copyid (in the object descriptor) and the storage manager is responsible for finding the requested data.
  • BSAGetObject()- Called to gather information about a particular storage manager object (ie, date created , size, owner etc).
  • BSAInit()- connects to the storage manager and starts a session. This function will return a 'handle' that is a unique identifier associated to that session.
  • BSAQueryApiVersion()- Called to validate which version of the XBSA libraries onbar is talking to.
  • BSASendData()- Sends a buffer full of data to the storage manager.
  • BSATerminate()- Terminates a session with the storage manager. It also frees up and resources that were allocated in the BSAinit call.


Below is a simplistic diagram on how an XBSA application goes. onbar (which is an XBSA applicalion in it self) follows this flow chart as well when creating/restoring archives. onbar will loop calling BSASendData (and BSAGetDATA) until the is no more data to process.




출처 : http://www.iiug.org/onbar/xbsa.html

728x90
728x90

안녕하세요. IBM Informix 12.10.xC10 버전부터 기본(Primary)/미러(Mirror) 청크(Chunk)를 교체하는 기능이 생겨 테스트를 해봤습니다.


제가 미러 청크를 만든 방법과 교체한 내용을 소개해 드리겠습니다.


1. onCONFIG 옵션 변경

미러 청크를 사용하려면 onCONFIG의 MIRROR 옵션을 1로 변경해야 합니다.

그리고 처음 미러 청크를 만드는 경우라면 MIRRORPATH는 공란으로 두어야 합니다.

MIRRORPATH는 root dbspace에 대한 청크 경로이므로 공란으로 두지 않으면 Informix 인스턴스가 시작되지 않습니다.


2. 기존의 청크에 미러 청크 생성하기

미러 청크를 생성하는 것은 onspaces 명령이나 sysadmin api를 통해 가능한데 여기서는 onspaces 명령으로 해보겠습니다.


먼저 기본 청크 경로를 확인합니다.


$ onstat -d


IBM Informix Dynamic Server Version 12.10.FC12W1WE -- on-Line -- Up 00:01:25 -- 227552 Kbytes


Dbspaces

address          number   flags      fchunk   nchunks  pgsize   flags    owner    name

700000020476028  1        0x4000001  1        2        4096     N  BA    informix rootdbs

7000000205abbe0  2        0x5000001  2        1        4096     N PBA    informix plog

700000020476dc8  3        0x4000001  3        1        4096     N  BA    informix llog

700000020477bf0  4        0x4000001  4        1        4096     N  BA    informix datadbs1

70000002058f850  5        0x4000001  5        1        4096     N  BA    informix datadbs2

70000002058fa90  6        0x4000001  6        1        4096     N  BA    informix datadbs3

70000002058fcd0  7        0x4000001  7        1        8192     N  BA    informix data8dbs1

700000022733028  8        0x4000001  8        1        8192     N  BA    informix data8dbs2

700000022733268  9        0x4000001  9        1        8192     N  BA    informix data8dbs3

7000000227334a8  10       0x2001     10       1        8192     N TBA    informix tmpdbspace

7000000227336e8  11       0x4008001  11       1        4096     N SBA    informix sbspace1

700000022733928  12       0xa001     12       1        4096     N UBA    informix tmpsbspace

 12 active, 2047 maximum


Chunks

address          chunk/dbs     offset     size       free       bpages     flags pathname

700000020476268  1      1      0          38912      5453                  PO-B-D /opt/IBM/informix/storage/rootdbs

700000022735028  2      2      0          16384      0                     PO-BED /opt/IBM/informix/storage/ol_informix1210_4_plog_p_1

700000022736028  3      3      0          151426     1373                  PO-BED /opt/IBM/informix/storage/ol_informix1210_4_llog_p_1

700000022737028  4      4      0          16384      15145                 PO-BED /opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1

700000022738028  5      5      0          16384      16331                 PO-BED /opt/IBM/informix/storage/ol_informix1210_4_datadbs2_p_1

700000022739028  6      6      0          16384      16331                 PO-BED /opt/IBM/informix/storage/ol_informix1210_4_datadbs3_p_1

70000002273a028  7      7      0          8192       8139                  PO-BED /opt/IBM/informix/storage/ol_informix1210_4_data8dbs1_p_1

70000002273b028  8      8      0          8192       8139                  PO-BED /opt/IBM/informix/storage/ol_informix1210_4_data8dbs2_p_1

70000002273c028  9      9      0          8192       8139                  PO-BED /opt/IBM/informix/storage/ol_informix1210_4_data8dbs3_p_1

70000002273d028  10     10     0          9216       9163                  PO-BE- /opt/IBM/informix/storage/ol_informix1210_4_tmpdbspace_p_1

70000002273e028  11     11     0          16384      11822      11879      POSB-D /opt/IBM/informix/storage/ol_informix1210_4_sbspace1_p_1

                                 Metadata 868        4138       868

70000002273f028  12     12     0          16384      11879      11879      POSB-- /opt/IBM/informix/storage/ol_informix1210_4_tmpsbspace_p_1

                                 Metadata 868        4138       868

700000022734028  13     1      0          16384      11097                 PO-BED /opt/IBM/informix/storage/ol_informix1210_4_rootdbs_p_1

 13 active, 32766 maximum


NOTE: The values in the "size" and "free" columns for DBspace chunks are

      displayed in terms of "pgsize" of the DBspace to which they belong.



Expanded chunk capacity mode: always



여기 예에서는 datadbs1 dbspace의 청크에 미러 청크를 생성해보겠습니다.


$ onspaces -m datadbs1 -p /opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1 -o 0 -m /opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1_mirror 0


WARNING: Turning mirror on for 'datadbs1'.


Do you really want to continue? (y/n)y

Verifying physical disk space, please wait ...

The Space "datadbs1" is now mirrored.


명령을 실행하면 미러 청크를 만들것인지 확인하는 메시지가 나옵니다.

여기서 'y' 를 입력하고 엔터를 누르면 미러 청크가 생성됩니다.


3. 생성한 미러 청크 확인

onstat -d 명령으로 미러 청크가 생성되었는지 확인합니다.

미러 청크의 경우 flags 값의 맨 처음 값이 M으로 표시됩니다.


$ onstat -d

...

Chunks

address          chunk/dbs     offset     size       free       bpages     flags pathname

700000020476268  1      1      0          38912      5453                  PO-B-D /opt/IBM/informix/storage/rootdbs

700000022735028  2      2      0          16384      0                     PO-BED /opt/IBM/informix/storage/ol_informix1210_4_plog_p_1

700000022736028  3      3      0          151426     1373                  PO-BED /opt/IBM/informix/storage/ol_informix1210_4_llog_p_1

700000022737028  4      4      0          16384      15145                 PO-B-D /opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1

700000022e2e028  4      4      0          16384      0                     MO-B-D /opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1_mirror



onstat -m 명령으로 로그 메시지를 확인해보면 아래와 같이 나옵니다.


$ onstat -m


IBM Informix Dynamic Server Version 12.10.FC12W1WE -- on-Line -- Up 00:03:19 -- 227552 Kbytes


Message Log File: /opt/IBM/informix/ol_informix1210_4.log

11:33:05  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 18, Llog used 2


11:33:06  Checkpoint Completed:  duration was 0 seconds.

11:33:06  Thu Apr 11 - loguniq 808, logpos 0x3b94050, timestamp: 0x69dc6db Interval: 284


11:33:06  Maximum server connections 0

11:33:06  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 1, Plog used 0, Llog used 3


11:33:06  The Space "datadbs1" is now mirrored.


11:33:06  Space 'datadbs1' -- Recovery Begins(700000020552ec8)

11:33:06  Chunk Number 4 - '/opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1_mirror' -- Recovery Begins(700000020552ec8)

11:33:23  Chunk Number 4 - '/opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1_mirror' -- online

11:33:23  Checkpoint Completed:  duration was 0 seconds.

11:33:23  Thu Apr 11 - loguniq 808, logpos 0x3b97018, timestamp: 0x69dc6e8 Interval: 285


11:33:23  Maximum server connections 0

11:33:23  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 0, Llog used 3


11:33:23  Space 'datadbs1' -- Recovery Complete(700000020552ec8)


Recovery Complete 메시지가 보이는 순간부터 미러링(Mirroring)이 시작됩니다.



4. 기본 청크와 미러 청크 교체하기

기본 청크와 미러 청크를 교체하려면 sysadmin의 task function의 swap_mirror 명령을 사용합니다.


$ dbaccess sysadmin -


Database selected.


> execute function task('modify chunk swap_mirror',4);




(expression)  Primary/mirror swap for chunk 4 succeeded.


1 row(s) retrieved.



5. 기본 청크와 미러 청크가 교체되었는지 확인

onstat -d 명령으로 기본 청크와 미러 청크가 교체되었는지 확인합니다.


$ onstat -d


...

Chunks

address          chunk/dbs     offset     size       free       bpages     flags pathname

700000020476268  1      1      0          38912      5453                  PO-B-D /opt/IBM/informix/storage/rootdbs

700000022735028  2      2      0          16384      0                     PO-BED /opt/IBM/informix/storage/ol_informix1210_4_plog_p_1

700000022736028  3      3      0          151426     1373                  PO-BED /opt/IBM/informix/storage/ol_informix1210_4_llog_p_1

700000022737028  4      4      0          16384      15145                 PO-B-D /opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1_mirror

700000022e2e028  4      4      0          16384      0                     MO-B-D /opt/IBM/informix/storage/ol_informix1210_4_datadbs1_p_1



onstat -m 명령으로 로그 메시지를 확인해보면 아래와 같이 나옵니다.


$ onstat -m


...

11:36:36  Primary/mirror swap for chunk 4 succeeded.

11:36:36  Checkpoint Completed:  duration was 1 seconds.

11:36:36  Thu Apr 11 - loguniq 808, logpos 0x3b9a07c, timestamp: 0x69dc70c Interval: 286


11:36:36  Maximum server connections 1

11:36:36  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 6, Llog used 3


미러링은 일반적으로 디스크 오류가 발생했을 때 데이터베이스 서버를 온라인에서 복구하기 위한 기능이지만,

swap_mirror 명령이 추가됨으로써 인스턴스가 온라인인 상태에서 파일을 교체할 수 있어, 스토리지 위치를 변경할 때 유용하게 사용할 수 있을 것 같습니다.


728x90
728x90

안녕하세요. 인포믹스 12.10.FC12, 12.10.FC12W1, 14.10.FC1 버전에서 발생하는 문제를 소개드립니다.


문제가 발생한 이후부터는 인포믹스 프로세스가 시작되지 않으므로 매우 치명적인 결함입니다.


문제가 발생할 수 있는 조건은 아래와 같습니다.

1. 해당 테이블에 VARCHAR 컬럼을 추가한다.

2. 추가한 VARCHAR 컬럼의 사이즈를 축소한다.


위와 같은 상황에서 UPDATE 문장을 실행하면 오류가 발생하면서 인포믹스 프로세스가 다운됩니다.

그러나 항상 다운되는 것은 아니고 대상 테이블에 저장된 데이터 길이에 따라 다운될 수도, 다운되지 않을 수도 있습니다.

아래는 인포믹스 12.10.FC12와 14.10.FC1 버전의 환경에서 다운되는 현상을 재현했을 때의 로그 메시지입니다.


## 12.10.FC12W1

11:20:01  Assert Failed: Buffer modified in inconsistent chunk.

11:20:01  IBM Informix Dynamic Server Version 12.10.FC12W1WE

11:20:01   Who: Session(87, informix@pilma01, 39452766, 700000020593858)

                Thread(222, sqlexec, 700000020553068, 10)

                File: rsdebug.c Line: 1047

11:20:01   Results: Chunk 13 is being taken OFFLINE.

11:20:01   Action: Restore space containing this chunk from the archive.

11:20:01  stack trace for pid 36175890 written to /work2/ifx1210fc12w1we/tmp/af.4c6a350

11:20:02   See Also: /work2/ifx1210fc12w1we/tmp/af.4c6a350, shmem.4c6a350.0

11:20:10  Buffer modified in inconsistent chunk.

11:20:11  Assert Failed: INFORMIX-OnLine Must ABORT

        Critical media failure.

11:20:11  IBM Informix Dynamic Server Version 12.10.FC12W1WE

11:20:11   Who: Session(87, informix@pilma01, 39452766, 700000020593858)

                Thread(222, sqlexec, 700000020553068, 10)

                File: rsmirror.c Line: 2080

11:20:11  stack trace for pid 36175890 written to /work2/ifx1210fc12w1we/tmp/af.4c6a350

11:20:12   See Also: /work2/ifx1210fc12w1we/tmp/af.4c6a350

11:20:19  Thread ID 222 will NOT be suspended because

          it is in a critical section.

11:20:19   See Also: /work2/ifx1210fc12w1we/tmp/af.4c6a350

11:20:19  rsmirror.c, line 2080, thread 222, proc id 36175890, INFORMIX-OnLine Must ABORT

        Critical media failure..

11:20:19  Fatal error in ADM VP at mt_fn.c:14593

11:20:19  Unexpected virtual processor termination: pid = 36175890, exit status = 0x1.

11:20:19  PANIC: Attempting to bring system down


## 14.10.FC1DE

12:46:54  Assert Failed: Buffer modified in inconsistent chunk.

12:46:54  IBM Informix Dynamic Server Version 14.10.FC1DE

12:46:54   Who: Session(46, informix@ifxdb1, 62804, 0x4526fbc8)

                Thread(55, sqlexec, 4522d8c8, 1)

                File: rsdebug.c Line: 908

12:46:54   Results: Chunk 1 is being taken OFFLINE.

12:46:54   Action: Restore space containing this chunk from the archive.

12:46:54  stack trace for pid 62571 written to /opt/IBM/Informix_Software_Bundle/tmp/af.41fb7ad

12:46:54   See Also: /opt/IBM/Informix_Software_Bundle/tmp/af.41fb7ad, shmem.41fb7ad.0

12:46:57  Buffer modified in inconsistent chunk.

12:46:58  Assert Failed: INFORMIX-OnLine Must ABORT

        Critical media failure.

12:46:58  IBM Informix Dynamic Server Version 14.10.FC1DE

12:46:58   Who: Session(46, informix@ifxdb1, 62804, 0x4526fbc8)

                Thread(55, sqlexec, 4522d8c8, 1)

                File: rsmirror.c Line: 2062

12:46:58  stack trace for pid 62571 written to /opt/IBM/Informix_Software_Bundle/tmp/af.41fb7ad

12:46:58   See Also: /opt/IBM/Informix_Software_Bundle/tmp/af.41fb7ad

12:47:02  Thread ID 55 will NOT be suspended because

          it is in a critical section.

12:47:02   See Also: /opt/IBM/Informix_Software_Bundle/tmp/af.41fb7ad

12:47:02  Starting crash time check of:

12:47:02  1. memory block headers

12:47:02  2. stacks

12:47:02  Crash time checking found no problems

12:47:02  rsmirror.c, line 2062, thread 55, proc id 62571, INFORMIX-OnLine Must ABORT

        Critical media failure..

12:47:02  The Master Daemon Died

12:47:02  PANIC: Attempting to bring system down



관련 내용으로 IBM에 기술지원을 요청했었습니다.

해당 문제는 해외에서 발생한 사례가 이미 있었다고 하고 재현 시나리오도 구체적이진 않지만 존재했습니다.

관련 문제를 서술한 문서의 링크는 아래입니다.

http://www-01.ibm.com/support/docview.wss?crawler=1&uid=swg1IT27997


장애 재현시의 메시지 로그에서 보이는 assert failure file 내용을 살펴보니 해당 사용자 스레드의 stack trace를 확인할 수 있었습니다.


0x00000001000af9cc (oninit)afstack

0x00000001000aeb5c (oninit)afhandler

0x00000001000af038 (oninit)affail_interface

0x00000001001b8844 (oninit)buffcheck

0x00000001002371a0 (oninit)buffput

0x0000000100b88640 (oninit)ckpgversion

0x0000000100b87af4 (oninit)rewrecord

0x0000000100b870ec (oninit)rsrewrec

0x000000010071ab00 (oninit)fmrewrec

0x00000001008382a0 (oninit)aud_sqisrewrec

0x0000000100d40a90 (oninit)doupdate

0x0000000100d3ff2c (oninit)chkrowcons

0x000000010114ea04 (oninit)dodmlrow

0x0000000101150eac (oninit)dodelupd

0x000000010083ee30 (oninit)aud_dodelupd

0x0000000100d1ec24 (oninit)excommand

0x00000001008c8590 (oninit)sq_execute

0x00000001008103ac (oninit)sqmain

0x00000001014d6898 (oninit)listen_verify

0x00000001014d530c (oninit)spawn_thread

0x0000000101482ae0 (oninit)th_init_initgls

0x00000001018f86e0 (oninit)startup


defect IT27997에 대해 서술한 내용과 상당히 유사한 stack trace 임을 알 수 있었습니다.

stack trace 중에서 ckpgversion function 부분이 문제인 듯 합니다.

그리고 12.10.FC12 버전부터 In-place alter 기능이 개선되었다고 알려져있는데, 이 개선으로 인해 defect가 발생한 것이 아닌가 생각도 듭니다. 물론 제 추측이기 때문에 정확한 원인으로 보기는 어렵습니다.

IIUG2018의 발표자료중 Jeff McMahon and Nick Geib가 발표한 What’s New in Informix 장표를 살표보면 VARCHAR 에서 VARCHAR 간 (smaller or larger) 사이즈를 변경하는 유형도 In-place alter 방식으로 이루어진다고 나와 있습니다.


아래는 위의 IT27997의 내용을 토대로 작성한 장애재현 스크립트 내용입니다.

테스트용 데이터는 60자 고정길이 필드 한개로 만드시면 재현이 쉽습니다.


drop table test;

create table test (a varchar(60));


load from test.unl insert into test;


alter table test add b int;

alter table test add c varchar(5);

alter table test add d varchar(5);

alter table test add e varchar(5);

alter table test modify c varchar(1);

alter table test modify d varchar(1);

alter table test modify e varchar(1);


update test set a=' qui officia deserunt mollit anim id est laborum.Lorem ip';


해당 문제는 12.10.FC12 및 12.10.FC12W1 에서 발생하는 문제이므로 해당버전을 사용중이라면 IBM에 패치버전을 요청하시거나 12.10.FC11 이하 버전으로 다운그레이드하면 문제가 발생하지 않습니다.


참고가 되시길 바랍니다.

728x90
728x90

안녕하세요. 우연히 IBM 문서에서 발견한 내용을 소개해 드립니다. 이렇게 매뉴얼을 정독하지 않은 티를 내게 되는군요.

인포믹스에서 UNIQUE 제약조건과 UNIQUE 인덱스의 기능에 차이가 있다는 내용입니다.

평소에 두개의 기능이 다를 것이라고 생각하지 않았는데, 알고나니 개발할 때 이런 점까지 고려해야 되나 생각이 들기도 하네요.


문서에서 설명한 주요 기능의 차이는 아래와 같습니다.

In DML statements, enabled unique constraints on a logged table are checked at the end of a statement, but unique indexes are checked on a row-by-row basis, thereby preventing any insert or update of a row that might potentially violate the uniqueness of the specified column (or for a multiple-column column constraint or index, the column list).


요약하자면, 로깅 모드 (unbuffered, buffered) 테이블에서는

unique 제약조건에서는 insert나 update 문장 실행의 끝날때 중복여부를 확인하고,

unique 인덱스에서는 row-by-row, 건건이 실행할 때마다 중복값을 확인한다는 차이가 있다는 것입니다.


위의 IBM 문서에 기반한 내용으로 아래의 시나리오를 만들어 봤습니다.


시나리오 #1 ==================

1. 정수형(integer) 데이터 타입 1개를 포함한 테이블 작성

> create table test (c int);


2. 테스트 데이터 10만개 입력

> insert into test select level from sysmaster:sysdual connect by level <= 100000;


3. 해당 컬럼에 UNIQUE 인덱스 생성

> create unique index test_idx on test(c);


4. UPDATE 문장 실행

> update test set c=c+1;


  346: Could not update a row in the table.    << UPDATE 문장 실행 즉시 오류가 발생합니다.


  100: ISAM error:  duplicate value for a record with unique key.


============================


시나리오 #2 ==================

1. 정수형(integer) 데이터 타입 1개를 포함한 테이블 작성, 해당 컬럼에 UNIQUE 제약조건 설정.

> create table test (c int, unique(c));


2. 테스트 데이터 10만개 입력

insert into test select level from sysmaster:sysdual connect by level <= 100000;


3. UPDATE 문장 실행

> update test set c=c+1;


100000 row(s) updated.    << 약 3~7초 정도 경과후 중복값 오류 없이 UPDATE가 실행됩니다.

============================


여기서 시나리오 2번에서 오류가 발생하지 않았으니 unique 제약조건으로 선언하는 것이 낫겠다는 생각이 들기도 합니다.

그러나 몇가지 고려할 사항이 있습니다.


unique 제약조건이 정의되어 있으면 UPDATE/INSERT 문장이 수행되는 도중에 중복값이 발생하더라도

오류가 곧바로 발생하지 않습니다. 아래에서 극단적인 예를 들어보겠습니다.


> drop table test;

> create table test (c int, unique(c));

> insert into test select level from sysmaster:sysdual connect by level <= 100000;


100000 row(s) inserted.


$ echo "update test set c=3;" | timex dbaccess stores_demo


Database selected.



  268: Unique constraint (informix.u160_134) violated.


  100: ISAM error:  duplicate value for a record with unique key.

Error in line 1

Near character position 18



Database closed.



real 37.48

user 0.02

sys  0.03


시나리오 #2의 내용과 동일한 테이블과 데이터를 만들고 같은 값 3으로 UPDATE를 실행했습니다.

unique 제약조건이 있기 때문에 사실 수행될 수 없는 문장입니다.

그러나 수행이 이뤄지고 마지막에 중복값을 확인하기 때문에 약 37초가 소요되었습니다.

수행시간은 시스템 성능에 따라 차이는 있겠지만 수행중 오류가 발생하고 변경사항이 rollback 되었음을 확인할 수 있습니다.


여기서 몇가지 더 의문이 생겼습니다.

그럼 primary key 제약조건에서어떨까?

unique 제약조건과 동일하게 268 오류가 발생했습니다.


그러면 unique 인덱스, primary key 제약조건을 만들었을때는?

마찬가지로 268 오류가 발생했습니다.


그럼 unique 인덱스, primary key 제약조건을 만들고 UPDATE 문장에 unique 인덱스를 사용하도록 힌트를 주었다면?

UPDATE 문장에서 INDEX를 강제로 사용하면 달라지지 않을까 예상했지만,

역시 아래와 같이 268 오류가 발생했습니다.


> drop table test;

> create table test (c int);

> insert into test select level from sysmaster:sysdual connect by level <= 100000;

> create unique index test_pk on test(c);

> alter table test add constraint primary key (c) constraint test_pk;


$ echo "update {+ explain index(test test_pk)} test set c=3;" | timex dbaccess stores_demo


Database selected.



  268: Unique constraint (informix.test_pk) violated.


  100: ISAM error:  duplicate value for a record with unique key.

Error in line 1

Near character position 50



Database closed.



real 39.24

user 0.02

sys  0.03



결론적으로 unique/primary key 제약조건이 설정된 경우에는

UPDATE/INSERT 문장이 실행된 이후에 중복값이 검사된다는 것입니다.

속성이 유일한 값이다보니 UPDATE가 드물긴 하겠지만, unique index와는 작동 방식이 다르니 참고할 필요는 있을 것 같습니다.



** 참고

https://www.ibm.com/support/knowledgecenter/en/SSGU8G_12.1.0/com.ibm.sqls.doc/ids_sqs_0517.htm

728x90
728x90

안녕하세요. 2019년 2월 8일자 IBM 알림 메일 내용 중 My notifications의 인포믹스 결함 내용을 소개드립니다.

(IT27956: SYSSESSIONS OCCASIONALLY NOT RETURNING CURRENT SESSION)

CURRENT 세션에 대한 정보가 가끔씩 표시되지 않는 결함에 대한 내용입니다.

보통 내용이 상세하게 설명되지 않은 경우가 많은데, 결함 내용을 재현하기 위한 프로그램 코드도 공개되어 있네요.

코드는 인포믹스를 사용하는 고객에게서 제공되었다고 하네요.

우선 에러에 대한 설명입니다.


Error description

Customers are facing again the problem of missing sessions in
sysmaster:syssessions (as reported in defect idsdb00096417) in
IDS 12.10.FC12W1.
The defect idsdb00096417 should be fixed in IDS 12.10.FC11.
However I am able to reproduce the issue in 12.10.FC10,
12.10.FC11, 12.10.FC12 and 12.10.FC12W1 using the following
reproducing scenario (provided by the customer).

고객사에서 사용중인 인포믹스 버전은 12.10이고 Fix level 까지는 정확히 알 수가 없네요.

다만 내용에서 유추하건데 12.10.FC10 버전에서 위의 현상이 최초로 발견된 것으로 보이고,

12.10.FC12W1 버전에서도 동일하게 재현된다고 하니 2019년 2월 11일 현재까지는 결함이 수정된 버전은 없는 상태입니다.


아래는 재현 시나리오에서 사용한 ESQL/C 코드와 쉘스크립트 내용입니다.


============== test_ec.ec ==============

#include <stdio.h>


$int c, sid;


main()

{

$database stores_demo;

$select DBINFO('sessionid') INTO :sid FROM sysmaster:sysdual;

$select COUNT(*) INTO :c FROM sysmaster:syssessions s WHERE

s.sid = :sid;

if ( c == 0 )

printf("SID: %d Count: %d\n",sid,c);

sleep(1);

}

===================================


============== test_ec_connections.sh ======

#!/bin/bash


LOOP_MAX=$1


while true

do

LOOP=1

while [ $LOOP -le $LOOP_MAX ]

do

./test_ec.exe &

LOOP=`expr $LOOP + 1`

done

sleep 2

date

done


===================================


$ esql -o test_ec.exe test_ec.ec


먼저 test_ec.ec 코드 내용을 살펴보겠습니다.

1. 인포믹스의 stores_demo에 접속

2. 접속한 현재 자신의 세션번호 확인

3. sysmaster:syssessions 테이블에서 자신의 세션번호 갯수 확인

>> 자신의 세션번호 갯수가 0개이면 메시지 출력


너무나 당연하게도 3번에서는 접속이 유지된 상태에서 자신의 세션번호 개수를 확인하는 것이니 1개입니다.

그런데 0개가 나오는 경우가 있다는 건데요.

여기서 이어지는 쉘 스크립트에서는 컴파일된 test_ec 프로그램을 동시에 여러개 실행하는 모양새가 됩니다.


우선은 아래 환경에서 위와 동일한 프로그램으로 테스트를 해봤습니다.

시스템 환경은 아래와 같습니다.

O/S : AIX 6.1

DBMS : Informix 11.50.FC9W3 / 11.70.FC9 / 12.10.FC6WE / 12.10.FC8WE / 12.10.FC12W1WE


문제가 보고된 12.10.FC12 버전에서 실행한 결과입니다.

$ onstat -


IBM Informix Dynamic Server Version 12.10.FC12W1WE -- on-Line -- Up 00:26:56 -- 234320 Kbytes


$ ./test_ec_connetions.sh 10

Mon Feb 11 23:24:22 KORST 2019

...

Mon Feb 11 23:24:47 KORST 2019

Mon Feb 11 23:24:50 KORST 2019

SID: 6081 Count: 0

Mon Feb 11 23:24:52 KORST 2019

SID: 6091 Count: 0

Mon Feb 11 23:24:54 KORST 2019

SID: 6100 Count: 0

Mon Feb 11 23:24:56 KORST 2019

SID: 6111 Count: 0

Mon Feb 11 23:24:58 KORST 2019

SID: 6120 Count: 0

Mon Feb 11 23:25:00 KORST 2019

SID: 6131 Count: 0

Mon Feb 11 23:25:02 KORST 2019

SID: 6140 Count: 0

Mon Feb 11 23:25:04 KORST 2019

SID: 6151 Count: 0

Mon Feb 11 23:25:06 KORST 2019

SID: 6160 Count: 0

Mon Feb 11 23:25:09 KORST 2019

SID: 6171 Count: 0

Mon Feb 11 23:25:11 KORST 2019

Mon Feb 11 23:25:13 KORST 2019

Mon Feb 11 23:25:15 KORST 2019

Mon Feb 11 23:25:17 KORST 2019

Mon Feb 11 23:25:19 KORST 2019

Mon Feb 11 23:25:21 KORST 2019


지속적으로 발생하지 않고 간혹 발생하는데요. 특정 세션 번호만 누락되는 것인지 해서 

아래 조건 절을 생략하고 확인해 봤습니다.


$select DBINFO('sessionid') INTO :sid FROM sysmaster:sysdual;

$select COUNT(*) INTO :c FROM sysmaster:syssessions s WHERE

s.sid = :sid;

if ( c == 0 )     <<  제거한 내용

printf("SID: %d Count: %d\n",sid,c);


$ ./test_ec_connetions.sh 10

SID: 6278 Count: 1

SID: 6279 Count: 1

SID: 6280 Count: 1

SID: 6281 Count: 1

SID: 6282 Count: 1

SID: 6283 Count: 1

SID: 6285 Count: 1

SID: 6284 Count: 1

SID: 6286 Count: 1

SID: 6287 Count: 1

Mon Feb 11 23:32:34 KORST 2019

SID: 6288 Count: 1

SID: 6289 Count: 1

SID: 6291 Count: 0     << 간혹 개수가 확인되지 않는 세션이 존재합니다.

SID: 6290 Count: 1

SID: 6292 Count: 1

SID: 6293 Count: 1

SID: 6294 Count: 1

SID: 6295 Count: 1

SID: 6296 Count: 1

SID: 6297 Count: 1

Mon Feb 11 23:32:36 KORST 2019

SID: 6298 Count: 1

SID: 6299 Count: 1

SID: 6300 Count: 0

SID: 6301 Count: 1

SID: 6302 Count: 1

SID: 6303 Count: 1

SID: 6304 Count: 1

SID: 6305 Count: 1

SID: 6306 Count: 1

SID: 6307 Count: 1

Mon Feb 11 23:32:38 KORST 2019

SID: 6308 Count: 1

SID: 6310 Count: 1

SID: 6309 Count: 1

SID: 6311 Count: 1

SID: 6312 Count: 1

SID: 6313 Count: 1

SID: 6314 Count: 1

SID: 6315 Count: 1

SID: 6316 Count: 1


다른 버전인 11.50과 11.70에서는 재현이 되지 않았습니다.

아직 해당 APAR인 IT27956이 OPEN 상태이므로 곧 해결된 버전이 나오지 않을까 기대해봅니다.


https://www-01.ibm.com/support/entdocview.wss?uid=swg1IT27956

728x90
728x90

안녕하세요. 2019년 2월자 IIUG insider에 따르면 인포믹스 14 버전이 2019년 상반기에 출시될 예정이라고 합니다.

작년에 IIUG World 컨퍼런스에서도 소개가 된 내용인데 버전 숫자까지 공개된 것은 처음이네요..

라고 생각했지만 웹에서 검색해보니 이미 작년부터 14.10 버전이야기가 나오고 있었네요.

서양에서는 13이라는 숫자를 확실히 싫어하는 걸까요?


곧 IBM에서 EAP(Early Access Program)도 시작하지 않을까 생각했는데,

이미 CURSOR 등의 회사나 고객사에서 베타테스트를 진행하고 있었던 모양입니다.

https://www.cursor-distribution.de/en/community/community-informix


아래 링크에서 인포믹스 14.10 버전의 새로운 기능을 확인하실 수 있습니다.

http://www.iiug.org/en/2019/02/04/iiug-insider-issue-222-january-2019/



Enhances log replay performance of remote secondary servers and OLTP transactions

      • Up to 5x improvement in replication enables client applications to sustain near zero latency between primary and secondary servers allowing faster recovery time objective in disaster scenarios.
      • Up to 10% faster than 12.10 for standard OLTP transactions

Provides higher security for encryption keys and integrated backup encryption

      • By supporting remote storage of encryption at rest keys in Amazon Key Manager, an additional layer of security is applied to Informix server encrypted data. Three ciphers AES128, AES192 and AES256 are supported.
      • By supporting remote key management server to generate encryption keys and reducing DBA effort to encrypt Informix data backups, data security in backup media is enhanced without the risk of losing keys. The encryption key is itself encrypted (called Envelop Encryption).
      • Transport Layer Security (TLS) to 1.2 for a higher level of network transport security.

Enhances usability, streamlines administration, and increases uptime

      • By supporting additional in-place alter operations on tables and data types, database downtime is avoided

Provides a new centralized and graphical administration tool called InformixHQ

      • InformixHQ is a modern web console for visualizing, monitoring, and managing your Informix server instances. It is purpose built for ease-of-use, scale-out, and optimizing DevOps needs.
      • It provides critical performance management capabilities, monitoring how key performance metrics are changing overtime and tracking how efficiently Informix is running your workload even when you’ve stepped away from your screen. Its monitoring system feeds directly into a customizable alerting system so you can be immediately alerted via email, Twilio, or PagerDuty whenever an issue occurs on one of your Informix database server instances.
      • It is designed to be scalable to efficiently manage and monitor as many Informix database server instances as you run.
      • It enables collaboration between the DBAs, the app developers, the ops engineers, and management and accessed from any desktop, laptop, or mobile device.
      • InformixHQ is the path forward for graphical monitoring, alerting, and administration of your Informix database servers.

Enhances Unicode support to current V11.0

      • Ability to support storage and processing for text characters that are new over the last 10 years. The new scripts and characters in Version 11.0 add support for lesser-used languages and unique written requirements worldwide.

Enhances time series granularity and spatial projection

      • Supporting Sub-second timestamps allow for very high speed event generation
      • Support for more geodetic and projections systems enables you to track packages in a shipping depot using your own coordinate system

Increased hardware limits at the Workgroup Edition level

      • New limits 24 cores / 32GB RAM enable higher performance and scalability for your critical applications providing even higher return on your Informix investment.

Includes storage optimization at the Enterprise Edition level

      • All Informix Enterprise edition deployments now benefit from the well proven data compression technology already built in Informix.
      • Data compression reduces primary, secondary, backups and log storage while simultaneously enhancing performance by reducing I/O operations.
      • Customers have reported average 4x reductions in database size while experiencing faster I/O operations and faster backups.

Common table expression

      • By implementing the SQL standard CTE, application developers improve readability and maintenance of complex queries, able to re-use CTE result-set multiple times in one query, Pipeline aggregations and write powerful recursive queries.
      • Complex queries can be divided into simple, ad hoc, logical building blocks. These simple blocks can then be used to build more complex, interim CTEs until the final result set is generated.

Setting up Informix instance/or database level replication using Enterprise Replication

      • Single command that automates setting up of Enterprise Replication and data migration between two Informix server instances located either on-prem or in the cloud. This command automates tasks such as defining Enterprise Replication domain between the two servers, adding key columns for the tables, creating required storage spaces for the databases, copying database schema from source server to target serve, creating replicate definitions and finally synchronizing data between source and target server instances, all in a transactional, flexibly phased manner, with no downtime.


** 출처

http://www.iiug.org/en/2019/02/04/iiug-insider-issue-222-january-2019/

http://www.hamburg-data.de/en/news/136-soon-informix-14-10

https://www.cursor-distribution.de/en/community/community-informix

728x90
728x90

인포믹스 11버전부터 데이터베이스 관리를 위한 sysadmin 데이터베이스가 있습니다.


sysadmin 데이터베이스에는 인포믹스 상태 정보를 보관하기 때문에,

계속해서 데이터가 유입된다면 데이터를 주기적으로 삭제하거나, 처음부터 여유있는 데이터 파일에 배치하는 것이 좋습니다.


그래서 sysadmin 데이터베이스를 스크립트를 사용하거나,

sysadmin 데이터베이스의 admin/task 프로시저를 사용해서 재생성할 수 있습니다.


1. 수동으로 sysadmin 데이터베이스 다시 만들기

IBM의 Technote에 따르면 $INFORMIXDIR/etc/sysadmin에 sysadmin 데이터베이스를 재생성하기 위한 스크립트가 있습니다.

아래의 명령을 순서대로 실행합니다.


cd $INFORMIXDIR/etc/sysadmin;

dbaccess - db_uninstall.sql;

dbaccess - db_create.sql;

dbaccess sysadmin db_install.sql;

dbaccess sysadmin sch_tasks.sql;

dbaccess sysadmin sch_aus.sql;

dbaccess sysadmin sch_sqlcap.sql;

dbaccess sysadmin start.sql;


여기서 db_create.sql 파일 내용을 살펴보면 데이터베이스를 생성하는 구문이 있습니다.


CREATE DATABASE sysadmin WITH LOG;


파일 내용을 수정해서 이 구문으로 dbspace를 지정할 수도 있을 것입니다.


2. sysadmin 데이터베이스의 프로시저를 사용해 sysadmin 데이터베이스 이동하기

sysadmin 데이터베이스에 admin/task 프로시저를 사용해서 sysadmin 데이터베이스를 재생성할 수 있습니다.


execute function task("reset sysadmin", "admindbs"); 


dbspace 명을 지정하지 않으면 rootdbs에 만들어집니다. 재생성이 완료되면 스케줄러가 자동으로 재시작됩니다.



** 참고

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

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

728x90
728x90

안녕하세요. 인포믹스 12.1 이전 버전에는 RANK/DENSE_RANK 함수 기능이 제공되지 않습니다.

따라서 별도 프로그램을 사용해야 합니다.


인터넷을 검색해보니 변수 처리하거나 상호연관 서브쿼리 (Correlated sub-query)를 이용하는 방법이 일반적인 것 같습니다.

참고해서 인포믹스 SQL과 FUNCTION으로 구현해 보았습니다.


## 샘플 데이터 입력

DROP TABLE scores;

CREATE TABLE scores

     (

         id serial not null,

         score int not null

     );


INSERT INTO scores (score) VALUES     (50);

INSERT INTO scores (score) VALUES     (40);

INSERT INTO scores (score) VALUES     (75);

INSERT INTO scores (score) VALUES     (80);

INSERT INTO scores (score) VALUES     (55);

INSERT INTO scores (score) VALUES     (50);



## SQL문 실행 예제

SQL문으로 RANK/DENSE_RANK 기능을 구현한 예제입니다.


select id, score, 

(select count(*)::int+1 end from scores a where a.score > b.score) rank,

(select count(distinct(a.score))::int+1 end from scores a where a.score > b.score) dense_rank

from scores b order by score desc;


         id       score          rank    dense_rank


          4          80             1             1

          3          75             2             2

          5          55             3             3

          1          50             4             4

          6          50             4             4

          2          40             6             5




## 함수로 구현 (ranking/dense_ranking)

동일한 값에 대한 순위를 평가하는 방법에 따라 RANK/DENSE_RANK 함수로 구분됩니다.

같은 세션에서 전역변수 처리하므로 여러번 실행하려면 init_ranking변수를 초기화 해야합니다.


DROP FUNCTION ranking;

CREATE FUNCTION  ranking (curr_val int) returning int ;

define global counter int default 0;

define global last_val int default 0;

define global seq_val int default 0;


if counter = 0 then

let counter = counter + 1;

elif seq_val - counter = 0 and last_val != curr_val then

let counter = counter + 1;

end if


let seq_val = seq_val + 1;

let last_val = curr_val;


if seq_val - counter > 1 then

return seq_val;

end if


return counter;

end function;



DROP FUNCTION dense_ranking;

CREATE FUNCTION  dense_ranking (curr_val int) returning int ;

define global counter int default 0;

define global last_val int default 0;


if counter = 0 or last_val != curr_val then

let counter = counter + 1;

end if


let last_val = curr_val;


return counter;

end function;



CREATE PROCEDURE  init_ranking ();

define global counter int default 0;

define global last_val int default 0;

define global seq_val int default 0;


let counter = 0;

let last_val = 0;

let seq_val = 0;

end procedure;



## 함수 실행 예제

call init_ranking ();

select id, score, ranking (score) rank from (select id,score from scores order by score desc);



         id       score        rank


          4          80           1

          3          75           2

          5          55           3

          1          50           4

          6          50           4

          2          40           6



call init_ranking ();

select id, score, dense_ranking (score) dense_ranking from (select id,score from scores order by score desc);



         id       score dense_ranking


          4          80             1

          3          75             2

          5          55             3

          1          50             4

          6          50             4

          2          40             5



코드는 예외처리가 더 필요할 것 같지만 결과는 잘 나온 것 같습니다.

참고가 되시길 바랍니다.



참조 사이트

https://mattmazur.com/2017/03/26/exploring-ranking-techniques-in-mysql/

http://informix-myview.blogspot.com/2012/09/in-search-of-rownum.html

728x90
728x90


Informix Dynamic Server and Linux -- Up and running

A cookbook for installing Linux and IDS





IDS was one of the first commercial database products ported to Linux. Today the advantages of running IDS 10.0 on the Linux platform are:

  • Support for new Linux platforms
  • Transparent optimization and exploitation of Linux environments
  • Exploitation of Linux 2.6 kernel features
  • Utilization of asynchronous I/O and direct I/O for enhancing I/O performance
  • Processor affinity to achieve improved scalability and parallelism
  • Performance optimization using configurable page sizes
  • Additional installation methods on Linux systems
  • Simple Network Management Protocol (SNMP) support
  • Interprocess communication with stream pipes
  • Scalability on the 2.6 kernel

This article describes a test configuration of IDS on Linux. By following the details I describe, you should be able to customize your own IDS configuration on Linux. We'll start by looking at the setup of Linux itself.

Installing Linux

Technical details for the sample system

The system used for installing Linux and IDS was a standard PC:

  • Pentium III 600MHz
  • 512MB RAM
  • 2 x 15.3GB disks (Maxtor 51536U3 ATA)

For IDS version 10.0 (32-bit) the CPU must be compatible with an Intel i686. Compatible CPU types should be at a minimum Intel Pentium II / Pentium Pro or AMD Athlon. For our sample system, the first disk was dedicated for installing the Linux OS, and the second disk provided space for the IDS databases. No partitions should exist on the disks.

Red Hat Enterprise Linux 4

For this example, Red Hat Enterprise Linux AS release 4 (Nahant) was installed on the sample PC. The following steps will help you to set up a Linux system that is ready to install and run IDS. Please note, the installation of Linux will destroy any operating system and data on the PC.

Detailed instructions can be found at the "Red Hat Enterprise Linux Documentation" page in the document "Red Hat Enterprise Linux Installation Guide for the x86, Itanium, and AMD64 Architectures.". See the Related topics section "Learn" for links.

During installation, you can use the default settings in most cases. Here are some hints and exceptions:

  • Boot the PC from the first of the 4 CDs.
  • In step Language Selection choose English.
  • In step Keyboard Configuration choose the layout for your keyboard.
  • In step Upgrade Examine select Install Red Hat Enterprise for a fresh install.
  • In step Automatic Partitioning select /dev/hda only (deselect /dev/hdb).
  • In step Package Installation Defaults select Customize software packages ....
  • In step Package Group Selection, make these selections:
    • in chapter Applications select Graphical Internet (get Firefox browser).
    • in chapter Development select Legacy Software Development (get packages for compatibility to older Red Hat versions).
  • Reboot after the installation is completed.
  • Log in as user root and open a terminal (Applications -> System Tools -> Terminal).
  • For IDS graphical tools, install OpenMotif runtime from CD #3:
    • Put CD #3 in the drive. It should be automatically mounted
    • To install the package, type following command in the terminal:
      1
      rpm -Uvh /media/cdrom/RedHat/RPMS/openmotif-2.2.3-6.RHEL4.2.i386.rpm
    • To eject the CD from the drive type the command:
      1
      eject
  • To access IDS raw devices with Kernel Asynchronous Input Output (KAIO), install libaio from CD#3:
    • Put CD#3 in the drive. It should be automatically mounted.
    • To install the package, type following command in the terminal:
      1
      rpm -Uvh /media/cdrom/RedHat/RPMS/libaio-0.3.102-1.i386.rpm
    • To eject the CD from the drive type the command:
      1
      eject

Novell SUSE Linux Enterprise Server 9

For this example SUSE Linux Enterprise Server 9 (SLES 9) was installed on the sample PC. The following steps should help to set up a Linux system which is ready to install and run IDS. Please note, the installation will destroy any operating system and data on the PC.

Detailed instructions can be found at the "SUSE Linux Documentation" page in the document "SUSE LINUX Enterprise Server 9 Administration and Installation" (PDF). See the Related topics section "Learn" for links.

During installation, you can use the default settings in most cases. Some hints and exceptions are listed below:

  • Boot the PC from the first of the 4 binary CDs.
  • In step Select your language, choose English (US).
  • In step Installation Settings
    • Click on Keyboard layout and choose the appropriate layout.
    • Click on Partitioning and check swap and root partitions are created in /dev/hda.
      • Choose Base partition setup on this proposal.
      • Choose root partition (should be /dev/hda2) and change its file system type to ext3 using the Edit menu.
    • Click on Time Zone and choose the appropriate time zone.
  • Accept the installation settings and confirm the start of installation.
  • Reboot after the installation is completed.
  • Log in and open a terminal (click on terminal looking icon in the panel).

Installing IDS

For this example, the trial version of IDS version 10 (32-bit) can be downloaded using installed Firefox or Konqueror browser from "Informix product family -- How to get Informix product downloads -- IBM Software" page. See the Related topics section "Get products and technologies" for a link. Click on Informix Dynamic Server EE V10.0 Trials for getting the tar archive iif.10.00.UC3R1TL.Linux.tar and save it to /tmp directory. Sign in with IBM ID and password may be required. Choose download using http.

If you are not already logged in as user root, then switch user id to root:

1
su -

Create group and user informix, and enter password:

1
2
3
groupadd informix<br>
useradd -g informix -m informix<br>
passwd informix

Unpack the downloaded archive of IDS:

1
2
3
4
mkdir /opt/informix<br>
chown informix:informix /opt/informix<br>
cd /opt/informix<br>
tar xvf /tmp/iif.10.00.UC3R1TL.Linux.tar

If you purchased IDS version 10, then you will probably get the IDS bundle. In this case copy the contents of directory SERVER of the unpacked bundle to the working directory and proceed.

Set environment:

1
export INFORMIXDIR=/opt/informix

Install the IDS packages:

1
./install_rpm -acceptlicense=yes

Logout from user root:

1
exit

Configuring IDS

Set up the environment

If you are not already logged in as user informix, then switch user id to informix:

1
su - informix

Create an environment file called ids.env using a graphical text editor (such as gedit or kate), for example:

1
gedit ids.env

Or, use the famous console editor vi:

1
vi ids.env

Add the following lines to the ids.env file:

1
2
3
export INFORMIXDIR=/opt/informix<br>
export INFORMIXSERVER=demo_on<br>
export PATH=$INFORMIXDIR/bin:$PATH

Save the file and exit the editor.

Set the environment for IDS:

1
. ./ids.env

(type: dot blank dot slash ids.env)
Each time you need to access this IDS instance you can set the environment from this file again.

Create and edit IDS configuration files:

1
2
3
cd $INFORMIXDIR/etc<br>
cp onconfig.std onconfig<br>
cp sqlhosts.std sqlhosts

Edit file onconfig using the editor of choice (see above), change parameters from - to:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ROOTPATH        /dev/online_root
-
ROOTPATH        /home/informix/dbspaces/online_root
 
MSGPATH         /usr/informix/online.log
-
MSGPATH         /home/informix/logs/online.log
 
LTAPEDEV        /dev/tapedev
-
LTAPEDEV        /dev/null
 
DBSERVERNAME
-
DBSERVERNAME    demo_on

Find the network node hostname of the machine:

1
uname -n

asterix is printed for example.

Edit file sqlhosts using the editor of choice (see above), change line from - to:

1
2
3
demo_on onipcshm        on_hostname     on_servername
-
demo_on onipcshm        asterix         demo_on

(Replace the word "asterix" with the network node hostname of your machine.)

Create the logs directory:

1
2
cd<br>
mkdir logs

Create the root dbspace:

1
2
3
4
mkdir dbspaces<br>
cd dbspaces<br>
touch online_root<br>
chmod 660 online_root

Startup and shutdown

Start and initialize the configured IDS instance:

1
oninit -iv

prints following message:

1
2
3
This action will initialize IBM Informix Dynamic Server;
any existing IBM Informix Dynamic Server databases will NOT be accessible -
Do you wish to continue (y/n)?

If you are certain that you want to initialize this instance of IDS, type y to initialize the instance. Note, all data will be lost if the instance has been used previously.

Now IDS is running. For testing purposes, you can create the demo database by executing the script dbaccessdemo7 To access databases, the console utility dbaccess can be used.

You can shut down the IDS instance with the command:

1
onmode -ky

and started (without initialization) with this command:

1
oninit

IDS documentation can be read online at "IBM Informix Dynamic Server information center" page. Manuals for all Informix products in different languages can be found at "Informix library" page. See the Related topics section "Learn" for links.

Configuring a raw device

The whole second disk from the example machine can be configured as a raw device. Please note all data will be lost on this disk.

The first step is to create a partition. For this, use the interactive console utility fdisk. Switch to user id root to run following commands:

1
fdisk /dev/hdb

For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
The number of cylinders for this disk is set to 29651.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
 
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
 
Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
 
The number of cylinders for this disk is set to 29651.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-29651, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-29651, default 29651):
Using default value 29651
 
Command (m for help): p
 
Disk /dev/hdb: 15.3 GB, 15303075840 bytes
16 heads, 63 sectors/track, 29651 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1       29651    14944072+  83  Linux
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.

To make sure the OS is informed about the partition table changes, run this command:

1
partprobe

Once the partition /dev/hdb1 is created, its permissions must be changed for use by IDS:

1
2
chown informix:informix /dev/hdb1<br>
chmod 660 /dev/hdb1

Note, the change of permissions may be required again after reboot of the machine. This can be done using an init script.

If you are not already logged in as user informix, then switch user id to informix:

1
su - informix

Set the environment for IDS:

1
. ./ids.env

(Type: dot blank dot slash ids.env)

To remember which chunks are configured, create symbolic links in the dbspaces directory:

1
ln -s /dev/hdb1 /home/informix/dbspaces/chunk1

Now we create the chunk path named '/home/informix/dbspaces/chunk1' of the dbspace named 'dbspace1'. The size of the partition in kilobytes can be found in raw 'Blocks' in output of 'fdisk' command 'p'. It is given as parameter of option '-s' and has the value 14944072 in our example. Switch to userid informix and set ids.env environment to run following commands:

1
2
onspaces -c -d dbspace1 -p /home/informix/dbspaces/chunk1 -o 0 -s
14944072

For testing, create the demo database in dbspace1:

1
dbaccessdemo7 -dbspace dbspace1

Conclusion

In this article we've walked through the installation and configuration of specific versions of Red Hat Enterprise Linux and SUSE Linux Enterprise Server for running IDS 10, to help you get Informix up and running on Linux without difficulty. Adaptation for newer versions of the operating systems should be easy by updating the version numbers of mentioned packages.

https://www.ibm.com/developerworks/data/library/techarticle/dm-0603breitfeld/index.html

728x90

+ Recent posts