728x90


Question

How can you use a SQL statement to find out the latest UPDATE STATISTICS HIGH and UPDATE STATISTICS MEDIUM commands that were run on a table?

Answer

INTRODUCTION

You can use a SQL statement to obtain information regarding each of the most recent UPDATE STATISTICS HIGH and UPDATE STATISTICS MEDIUM commands that ran against a table.

The type of information you can obtain from the most recent update statistics is the following:

  • The date on which it ran
  • The mode used (high or medium)
  • The column(s) it ran against
  • The resolution used
  • The confidence level used


STEPS 

You can run this SELECT statement from any application: 

    SELECT UNIQUE tabname,colname,constructed,mode, 
           resolution,confidence 
    FROM  systable s t, syscolumns c, sysdistrib d 
    WHERE d.tabid = c.tabi d  AND d.colno = c.colno A ND 
           d.tabid = t.tabid AND 
           t.tabname=' tablename ' 
    ORDER BY 1,2;

    tablename
      The name of the table you want the distribution information for.


The SELECT statement will output columns. The following table indicates their meaning: 

Column
Description
tabname
The name of the table
colname
The name of the particular column in the table that the distribution had ran.
constructed
The date when the UPDATE STATISTICS statement had ran. (The date of construction of the data distribution.)
mode
What mode the UPDATE STATISTICS used.

H = HIGH
M = MEDIUM

There will never be an L because UPDATE STATISTICS LOW does not construct a data distribution.
resolution
The resolution used by the UPDATE STATISTICS statement
confidence
The confidence level used by the UPDATE STATISTICS statement

    Note: The confidence level for distributions run in high mode is irrelevant so it should always be set to zero.

Example: 

This example shows that UPDATE STATISTICS was last run on 8 July 2003. The column named  code of the table named  state had its distribution updated in High mode. It used a resolution of .5. The mode was high so there is no confidence level. 

The column named  sname in the same table had its distribution built in medium mode. It used a resolution of 2.5 and a confidence level of approximately 0.95. 

    tabname      state 
    colname      code 
    constructed  07/08/2003 
    mode         H 
    resolution   0.5 
    confidence   0.00 

    tabname      state 
    colname      sname 
    constructed  07/08/2003 
    mode         M 
    resolution   2.500000000000 
    confidence   0.94999999

You can also find this information from the UNIX or Windows command line using the dbschema utility (see Related Information section). 


COMMON PROBLEMS 

Symptom: You run the SELECT previously mentioned and you see this message   
    No rows found is returned.


Resolution: It means the table does not have data distribution. You can run the UPDATE STATISTICS command for the table to generate the data distribution.


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

728x90
728x90


Problem(Abstract)

How to retrieve when and for which columns the distributions were last built.

Resolving the problem

INTRODUCTION

This article shows a SQL statement which can be executed to retrieve when and for which columns the distributions were last built. However, if a column does not have a distribution it will not appear in the query output.


STEPS

select systables.tabname, syscolumns.colname, 
      sysdistrib.constructed,mode
from sysdistrib,systables,syscolumns
where systables.tabid > 99
and systables.tabid = syscolumns.tabid
and sysdistrib.tabid=systables.tabid
and sysdistrib.colno = syscolumns.colno
group by 1,2,3,4
order by tabname,colname;


Example

Assuming that 

    UPDATE STATISTICS HIGH for table customer (customer_num) 
was run, what follows is the corresponding information returned by the query for the table customer
     
    tabname      customer 
    colname      customer_num 
    constructed  12/15/2006 
    mode         H 


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

728x90
728x90

Problem(Abstract)

Running ontape L 0 archive can fail with the following error

Archive failed - access sysmaster database (SQL:-404 ISAM:0)

Cause

Certain env variables set

Resolving the problem

determine if any of the following environment variables are set and unset them

  • IFX_AUTOFREE
  • IFX_DEFERRED_PREPARE
  • OPTOFC


http://www-01.ibm.com/support/docview.wss?uid=swg21648070&myns=swgimgmt&mynp=OCSSGU8G&mync=E

728x90
728x90


Question

Forcing a named index to be used as the index associated with a primary key or a foreign key. Here is how.

Cause

System generated names for primary and foreign key indexes and constraints.

Answer

There are times that you may want to specify the name of the index associated with a foreign key constraint or a primary key constraint rather than having one generated by the engine. You may, for instance, want to use the index name as part of an optimizer directive to be used on the same table in more than one instance.

To specify a name for the index associated with a primary key constraint or a foreign key constraint do the following:

    1. Create the table without including the PRIMARY KEY or FOREIGN KEY clause. 

    2. Create a unique index on the columns used by the primary key or foreign key you want to create. This index will be the one that will be used by your primary key or foreign key constraint. 

      Example: 

      If you are going to create a primary key on the columns col1 and col2 of a table named tab2 and you want the index to be named ixtab2 you would use this statement to create the index: 
        CREATE UNIQUE INDEX ixtab2 on tab2(col1,col2);


    3. Alter the table to add the primary key or foreign key constraint. The engine will detect that a unique index already exists on the columns and use that index automatically.


      Example: 

      Continuing the previous example, the following ALTER TABLE statement would create primary key constraint that uses the index ixtab2: 
        ALTER TABLE tab2 ADD CONSTRAINT PRIMARY KEY(col1,col2);

If you place both a primary key constraint and a foreign key constraint on the same columns of a table then both constraints will use the same index. 



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

728x90
728x90

AIX용 Informix C-ISAM을 기본 설치 디렉토리인 /usr에 설치할 때 발생하는 오류입니다.

스크립트상 오류인지 /usr 디렉토리에 라이브러리를 설치하지 못하도록 한 것인지는 정확히 모르겠습니다만 

다른 디렉토리로는 잘 설치됩니다.

현재까지 확인한 결과로는 7.26.FC2, 7.26.FC3 버전에서 문제가 있었습니다.


./installisam (설치 스크립트 실행)


....


You may specify a target location for these files other than "/usr"

at this time if you so desire.  Do you wish to change the target

location for the directories?


Enter Y to change target directory or RETURN to continue.

(여기서 Y 옵션을 선택하면 디렉토리를 지정하여 설치할 수 있습니다. 엔터를 입력하면 /usr에 설치합니다.)


The default target directory of /usr will be used.

Moving Binaries to /usr/bin

./installisam[190]: test: 0403-004 Specify a parameter with this command.

./installisam[194]: test: 0403-004 Specify a parameter with this command.

Making

Usage: mkdir [-p] [-m mode] Directory ...

Usage: chmod [-R] [-f] [-h] {u|g|o|a ...} {+|-|=} {r|w|x|X|s|t ...} File ...

        chmod [-R] [-f] [-h] OctalNumber File ...

        Changes the permission codes for files or directories.

Moving Libraries to

Usage: mv [-I] [-i | -f] [-E{force|ignore|warn}] [--] src target

   or: mv [-I] [-i | -f] [-E{force|ignore|warn}] [--] src1 ... srcN directory

chmod: *lib*isam*.*: A file or directory in the path name does not exist.

chmod: llib-lisam: A file or directory in the path name does not exist.

chmod: *libifisam*.s*: A file or directory in the path name does not exist.

ar: 0707-100 /*lib*isam*.a does not exist.

ranlib: 0654-601 Execution of ar failed

Usage: ranlib [-t] [-X {32|64|32_64}] [--] file ...

ar: 0707-100 /libisamnls.a does not exist.

ranlib: 0654-601 Execution of ar failed

Usage: ranlib [-t] [-X {32|64|32_64}] [--] file ...

Moving Headers to /usr/include

Moving Localization files to /usr/gls


C-ISAM Installation Complete.


설치하는 과정에서 라이브러리(lib) 파일은 복사가 되지 않습니다.

installisam 스크립트를 살펴보면 라이브러리 경로가 지정되어 있지 않습니다.


BIN='bcheck dblog glfiles'

BINDIR='/usr/bin'


LIB='*lib*isam*.* llib-lisam'

SHLIB='*libifisam*.s*'

LIBDIR=''


INCL='isam.h decimal.h'

INCLDIR='/usr/include'


GLS='gls'

GLSDIR='/usr'


기본적으로 Informix C-ISAM을 설치하면 다음 네 개의 디렉토리에 파일이 설치가 됩니다.

bin

lib

include

gls


설치시 지정한 디렉토리가 만약에 /home/informix/cisam 이라고 한다면 각각 다음 위치에 설치 될 것입니다.

/home/informix/cisam/bin

/home/informix/cisam/lib

/home/informix/cisam/include

/home/informix/cisam/gls



해결책 ① 설치 스크립트인 installisam을 다음과 같이 수정하는 방법이 있습니다.

LIBDIR='' → LIBDIR='/usr/lib'


해결책 ② 설치 수행 중에 설치 디렉토리를 /usr로 지정하는 방법이 있습니다.


You may specify a target location for these files other than "/usr"

at this time if you so desire.  Do you wish to change the target

location for the directories?


Enter Y to change target directory or RETURN to continue.

Y (디렉토리를 변경하려면 Y를 입력합니다.)

Enter new target directory.

/usr (설치할 디렉토리 위치 /usr을 지정합니다.)

You have selected /usr as the new target directory.

If this is correct enter Y.

Y (최종 확인합니다.)


Moving Binaries to /usr/bin

Moving Libraries to /usr/lib

Moving Headers to /usr/include

Moving Localization files to /usr/gls


C-ISAM Installation Complete.


③ 라이브러리 파일을 직접 복사합니다.

압축을 해제하면 다음 파일이 있습니다. 직접 /usr/lib 디렉토리에 복사,이동해도 됩니다.


libifisam.a

libifisam.so

libifisamx.so

libisam.a

libisamnls.a

llib-lisam



내용을 가져가실때는 출처를 명시해주시기 바랍니다.

728x90
728x90


Problem(Abstract)

KAIO is not enabled when chunks are created on raw devices. OS and related environment are no problems.

Cause

ls -l shows that the chunks are in the raw devices which are created as block devices by mistake.

ls -l
brw-rw---- 1 root system 22, 1 Aug 4 2012 rootchk
brw-rw---- 1 root system 22, 1 Aug 4 2012 llogchk
brw-rw---- 1 root system 22, 1 Aug 4 2012 plogchk
brw-rw---- 1 root system 22, 1 Aug 4 2012 datachk


The raw devices should be character devices.
crw-rw---- 1 root system 22, 1 Aug 4 2012 rootchk
crw-rw---- 1 root system 22, 1 Aug 4 2012 llogchk
crw-rw---- 1 root system 22, 1 Aug 4 2012 plogchk
crw-rw---- 1 root system 22, 1 Aug 4 2012 datachk

Resolving the problem

Change the devices to character devices with relative OS commands and restart Informix Server. Then KAIO will be enabled correctly.


http://www-01.ibm.com/support/docview.wss?uid=swg21646086&myns=swgimgmt&mynp=OCSSGU8G&mync=E

728x90
728x90


Problem(Abstract)

The following query is to identify the 10 slowest SQL queries from syssqltrace. 

Note : SQLTRACE in $ONCONFIG need to be enabled in order to trace the SQL Queries.

Resolving the problem

To find the SQL Queries:

SELECT FIRST 10 * FROM sysmaster:syssqltrace  WHERE sql_runtime > 0  ORDER BY sql_runtime DESC; 

Then you can use the sql_id to query the sqltrace_iter tables to get the SQL statement iterators info. 

Syntax:
select * from sysmaster:syssqltrace_iter where sql_id = <sid> 

Example:
> select * from syssqltrace_iter where sql_id = 4; 

sql_id             4 
sql_address        504403159339495528 
sql_itr_address    504403159339512048 
sql_itr_id         1 
sql_itr_left       0 
sql_itr_right      0 
sql_itr_cost       9 
sql_itr_estrows    100 
sql_itr_numrows    1 
sql_itr_type       1 
sql_itr_misc       65672 
sql_itr_info       Seq Scan 
sql_itr_time       4.16157768e-05 
sql_itr_partnum    38 
sql_itr_sender     0 
sql_itr_nxtsender  0



728x90
728x90

* SP_AUTOEXPAND 가 0일때 (onstat -d에서 DBSPACE 다섯번쨰 플래그 없음)

1. chunk extendable (onstat -d에서 청크 다섯번째 플래그 'E') 상태이더라도 자동으로 청크가 확장되지 않음

2. 수동으로 chunk extend 명령을 수행할 수 있음

e.g. execute function task("modify chunk extend",4,"10000");



* SP_AUTOEXPAND 가 1일때,(onstat -d에서 DBSPACE 다섯번쨰 플래그 'A') 

1. chunk extendable (onstat -d에서 청크 다섯번째 플래그 'E') 상태일 때 자동으로 청크가 확장됨

2. 기본적으로 sysmater:sysdbstab의 extend_size 값에 따라 증가하는 것으로 보임 (기본값 create_size 10, extend_size 10000)

3. 대체로 기본값인 10MB 씩 증가하지만 꼭 10MB씩 일정하게 증가하는 것은 아님,

extend_size를 10000으로 설정하고 100MB 데이터를 지속적으로 로드했을 때, 

10,000KB - 16,384KB - 32,768KB - 65,536KB 순으로 증가하는 크기가 늘어남

(다른 사이트의 예나 인포센터를 참조했을 때 create_size, extend_size는 최소 증가 사이즈.

더 크게 증가하는 경우는 내부적으로나 매뉴얼에 명시된 계산식이 있는 듯함)



http://www.ibm.com/developerworks/data/library/techarticle/dm-1103storageprovisioning/#expanding

https://www.ibm.com/developerworks/community/blogs/informix_admins_blog/entry/expandable_chunks_in_informix_11_701?lang=en

728x90
728x90

Question

You are using an IBM Informix Server. You want to determine the edition of product that you have installed.

Answer

Your INFORMIXDIR will have a subdirectory with the name "license" or "ids_license." Find the file in the license subdirectory that is appropriate for the language you use. Open the file and search for the program edition statement. For example, in the English language file, a search on "Edition" yields a line like the following:

Program Name: IBM Informix Ultimate Edition V11.70

In this case you have a fixpak of IBM Informix Server 11.70 installed and it is Ultimate Edition.


http://www-01.ibm.com/support/docview.wss?uid=swg21642781&myns=swgimgmt&mynp=OCSSGU8G&mync=E

728x90
728x90

데이터 정합성이 맞지않거나 통계정보 부정확등의 이유에 인해 dbexport로 추출된 데이터 건수가 실제 내려받은 데이터 건수와 다른 경우에 발생하는 오류 케이스입니다.


It might happen that the number of rows in the unload file does not match the number of rows in the

comment. In such cases the dbimport will fail.

dbimport often runs several hours and it is painful when it aborts after hours leaving a corrupted database.

Customers rely that a successful dbexport is usable for dbimport. Example: mstab00100.unl contains 5 rows instead of 3

(여기 예제에서는 실제로 데이터는 5건을 내려받았으나 메타정보로는 3건으로 표시하고 있습니다.)
{ TABLE "informix".mstab row size = 14 number of columns = 2
index size = 0 }
{ unload file name = mstab00100.unl number of rows = 3 }
create table "informix".mstab
  (
    id serial not null ,
    c1 char(10)
  );
revoke all on "informix".mstab from "public" as "informix";
Import data is corrupted! 
이 메시지는 실제로 데이터가 로케일이 다르거나 깨진 데이터로 인해 발생할 수도 있습니다.
또한 PK(Primary Key)에 의한 데이터 중복이 원인일 수 있습니다.
위의 결과는 데이터에 문제가 없더라도 데이터 건수 차이로 인한 오류메시지가 발생한 예 입니다.
Do you want to abort?y
This import is now invalid.
Calling dbimport with -c or continue although the number of rows is wrong is not an option
because the imported data might not be consistent.


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

728x90

+ Recent posts