728x90

Problem(Abstract)

This document explains how you can use a SQL statement to find out the temporary tables that are currently created

Resolving the problem

INTRODUCTION

You can use a SQL statement to obtain information regarding each of the temporary tables that are currently created.


STEPS

You can run the following SELECT statement from any application:

    SELECT t.tabname ,t.dbsname,t.owner,
           DECODE(d.is_logging,1,"Y","N") AS db_with_log,
           s.name AS dbspace,
           DBINFO("UTC_TO_DATETIME",ti_created) AS created,
           DECODE(hex(mod(ti_flags,256)/16),6,"Y","N") AS
           table_using_log,ti_npused AS num_usedpages,
           ti_nptotal AS num_pages
    FROM   sysmaster:systabnames t, sysmaster:systabinfo i,
           sysmaster:sysdbspaces s, sysmaster:sysdatabases d
    WHERE  t.partnum=ti_partnum AND
           d.name=t.dbsname AND
           s.dbsnum=TRUNC(t.partnum/1048576) AND
           hex(mod(ti_flags,256)/16) IN ( 6,2 )

Column​​
Description​​
tabname​​
The name of the temporary table​​
dbsname​​
The name of the database where the temporary table was created​​
owner​​
The name of the user that created the temporary table​​
db_with_log​​
If the database is not currently using logging a ​​N​​ will be added to this column. And a ​​Y​​ will be added if the database is using logging.​​
dbspace​​
Name of the dbspace where the temporary table is created​​
created​​
The date and time when the temporary table was created​​
table_using_log​​
If the temporary table is using logging a ​​Y​​ will be added to this column. And a ​​N​​ will be added if the temporary table is not using logging.​​
num_usedpages​​
Number of pages current in use by the temporary table​​
num_pages​​
Total number of pages allocated for the temporary table​​


Example:

This example shows two temporary tables created on May 23rd, 2005. The temp1 table was created without the WITH NO LOG option. The temp2 table was created using the WITH NO LOG option. 

    tabname          temp1
    dbsname          stores_demo
    owner            informix
    db_with_log      Y
    dbspace          rootdbs
    created          2005-05-23 16:44:24
    table_using_log  Y
    num_usedpages    1
    num_pages        8

    tabname          temp2
    dbsname          stores_demo
    owner            informix
    db_with_log      Y
    dbspace          rootdbs
    created          2005-05-23 16:44:24
    table_using_log  N
    num_usedpages    1
    num_pages        8


COMMON PROBLEMS

Symptom: After you execute the SELECT previously mentioned, the following message is returned:

    No rows found.

Resolution: It means that no temporary table has been created.

Symptom: After you execute the SELECT previously mentioned, all the temporary tables have thetable_using_log column with a N value, and the db_with_log column has a N value.

Resolution: The symptom described above is expected since all temporary tables created in a database with no logging, are also created as no logging tables.



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

728x90
728x90

Question


Reporting the total amount of disk space used for each database in an instance - How to find?

Answer

The query in the CODE section is used to allow the database administrator to use system catalog tables to find how much space is being used by each database in an instance.

The results are interpreted as follows:

    dbspace
      name of the dbspace
    database
      name of the database
    total
      total pages used for a database
    used
      total pages used for both data and indexes
    data
      total pages used for data
    idx
      total pages used for indexes

CODE
    DATABASE sysmaster;
    SELECT s.name dbspace,
      n.dbsname database,
      SUM(ti_nptotal) total, 
      SUM(ti_npused) used,
      SUM(ti_npdata) data, 
      SUM(ti_npused) - SUM(ti_npdata) idx
    FROM systabinfo i,systabnames n, sysdbspaces s
    WHERE i.ti_partnum = n.partnum 
    AND partdbsnum(i.ti_partnum)=s.dbsnum 
    GROUP BY 1,2
    ORDER BY 1,2

SAMPLE OUTPUT

dbspace   rootdbs930uc1
database  central
total     680
used      449
data      263
idx       186

dbspace   rootdbs930uc1
database  client
total     664
used      447
data      262
idx       185


NOTE : The output values are in pages.



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

728x90
728x90



http://www.ibm.com/developerworks/data/zones/informix/library/techarticle/0305parker/0305parker.html

728x90
728x90

Problem(Abstract)

This script compares the permission and ownerships of files in a file distribution list with the binaries in the installed Informix product. It generates a list of problems and also a script to correct the permissions and ownership.

Cause

Incorrect permissions or ownership of IBM Informix files might result in product malfunction.


Resolving the problem

This Korn-Shell script will check the permission and ownership of the files that came with your Informix product. It will check the Informix file distribution list against files on the disk to verify that all have the correct ownerships and permissions. 

The script will create two output files in the current directory.


To use the script take these steps:
    1. Copy the file file_check.sh.txt to a work directory. Change the name to file_check.sh.

    2. Run the script using this syntax:
      file_check.sh -f filename [-d directory]
        filename
          The file distribution list (required)
        directory
          The path to the directory in which your Informix products are installed. If this is not given then the value of $INFORMIXDIR will be used.
    The name of the file distribution list will vary depending on the product. It will always be located in the $INFORMIXDIR/etc directory and will always end with the word files.

      Examples:
        The file distribution list ​​
        ​​for this product...​​
        ...has this name​​
        IBM Informix online Dynamic Server (OnLine)​​
        $INFORMIXDIR/etc/onlinefiles​​
        IBM Informix Extended Parallel Server (XPS)​​
        $INFORMIXDIR/etc/onlinefiles​​
        IBM Informix Dynamic Server (IDS) version 7​​
        $INFORMIXDIR/etc/IDSfiles​​
        IBM Informix Dynamic Server (IDS) version 9, 10 & 11​​
        $INFORMIXDIR/etc/IIFfiles​​
        IBM Informix Client SDK ​​
        (CSDK)​​
        $INFORMIXDIR/etc/clientsdkfiles​​

About missing files

When file_check.sh reports a missing file it means that the file is listed in the file distribution list but does not exist. This is not always a problem. 

Sometimes a file will be removed from a release and due to an oversight the file name will not be removed from the file distribution list. When this occurs it will not cause problems.

Consider the notice of a missing file to be a notification of a potential problem.


Sample Output

These are the output files from a sample run of file_check.sh. This run found 4 "missing" files and one file with the wrong group and permissions.
    Contents of file_check.sh.out
      Missing File(s)
      /usr/informix/msg/en_us/0333/nforms.iem
      /usr/informix/msg/en_us/0333/nformbld.iem
      /usr/informix/etc/sqlhosts.demo
      /usr/informix/etc/Termcap

      Wrong Group (Run ./file_check.sh.update for fix)
      /usr/informix/bin/onstat

      Wrong Owner (Run ./file_check.sh.update for fix)
      No File Found

      Wrong Permission (Run ./file_check.sh.update for fix)
      /usr/informix/bin/onstat

    Contents of file_check.sh.update
      chgrp informix /usr/informix/bin/onstat
      chmod 2755 /usr/informix/bin/onstat

Cross Reference information
SegmentProductComponentPlatformVersionEdition
Information ManagementInformix Extended Parallel Server (XPS)UNIXAll VersionsAll Editions
Information ManagementInformix onLineNot ApplicableUNIXAll Versions
Information ManagementInformix SENot ApplicableUNIXVersion Independent
Information ManagementInformix ToolsNot ApplicableUNIXAll Versions
Information ManagementInformix C-ISAMNot ApplicableUNIXVersion Independent


file_check.sh.txt



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

file_check.sh.txt
0.01MB
728x90
728x90

質問

テーブルの現在および追加可能なエクステント数の取得について

回答

[質問]
作成したすべてのテーブルの、現在のエクステント数および追加可能なエクステント数を、容易に取得する方法はありますか。
(테이블의 현재 익스텐트 및 추가 가능한 익스텐트 개수를 쉽게 얻는 방법이 있습니까?)

[回答]
データベース sysmaster に対して、以下のSQL文を実行すると、現在のエクステント数および追加可能なエクステント数を、取得することができます。(sysmaster 데이터베이스에 접속하여 다음 SQL 문을 실행하면 현재 익스텐트 및 추가 가능한 익스텐트 개수를 검색할 수 있습니다.)


SELECT
st.dbsname[1,25] AS dbname,
st.tabname[1,35] AS dbobject,
count(*) num_of_extents,
trunc((pgh.pg_frcnt/8),0) additional_extents
FROM sysptnext ptn, sysptnhdr pth, syspaghdr pgh, systabnames st
WHERE st.partnum = ptn.pe_partnum AND st.partnum = pth.partnum 
AND pgh.pg_partnum = ((trunc(st.partnum/1048576,0)*1048576)+1)
AND pgh.pg_pagenum = (st.partnum-(trunc(st.partnum/1048576,0)*1048576))
AND st.dbsname NOT LIKE "sys%"
AND st.tabname NOT LIKE "sys%"
AND st.tabname NOT LIKE " %"
AND st.tabname NOT LIKE "TBLSpace%"
GROUP BY 1, 2, 4
ORDER BY 1, 2;


以下は出力例です。(다음은 출력 예입니다.)

dbname test_db  <-- データベース名 (데이터베이스 이름)
dbobject test_tbl  <-- テーブル名 (테이블 이름)
num_of_extents 2     <-- 現在のエクステント数 (현재 익스텐트 개수)
additional_extents 229    <-- 追加可能なエクステント数 (추가 가능한 익스텐트 개수)



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

728x90
728x90

Question

How do you determine table space usage within a dbspace ?

Answer

INTRODUCTION

You may need to determine the amount of space each table uses within a dbspace. The sysmaster table sysptnext contains information about the start and size of partitions within the database server. You can query this table to determine table usage within a dbspace.


STEPS

To retrieve space usage information about tables in a dbspace, execute the following sql statement:

    SELECT DBINFO( "DBSPACE" , pe_partnum ) dbspace, dbsname databasename, tabname tablename, pe_size num_pages 
    FROM  sysmaster:sysptnext a, sysmaster:systabnames b 
    WHERE a.pe_partnum = b.partnum AND 
    DBINFO( "DBSPACE" , pe_partnum ) IN ("dbspacename1", "dbspacename2" ) 
    ORDER BY dbspace, num_pages DESC;

    dbspacename1, dbspacename2
      a comma separated list of the dbspace(s) for which you want the information



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

728x90
728x90

Question

How to check what tables are created in any specific dbspace

Answer

The following command can be executed from the UNIX command line on the sysmaster database to find out what are all the tables created on any specific dbspace. The <dbspace> should be replaced with the real dbspace name.

echo "select tabname from sysptnext, systabnames
where pe_partnum = partnum and dbinfo( 'DBSPACE' , pe_partnum ) = <dbspace> group by pe_partnum, dbsname, tabname
order by tabname"|dbaccess sysmaster

For example, to list out all the tables created on dbspace3, the above query will be like below:

echo "select tabname from sysptnext, systabnames
where pe_partnum = partnum and dbinfo( 'DBSPACE' , pe_partnum ) = 'dbspace3'
group by pe_partnum, dbsname, tabname
order by tabname"|dbaccess sysmaster

Sample output:

Database selected.



tabname TBLSpace

tabname alcatel_a_interface_bssap_week

tabname alcatel_bearer_bearer_channel_month

tabname alcatel_bsc_fabric_gch_week

tabname alcatel_bsc_fabric_tbf_monitoring_per_gpu_month

tabname alcatel_bsc_overviewchannel_week

tabname alcatel_cell_agch_month

tabname alcatel_cell_bvc_week

tabname alcatel_cell_directed_retry_month

tabname alcatel_cell_dl_tbf_establishments_1_week

tabname alcatel_cell_dl_tbf_releases_month

tabname alcatel_cell_dtap_week

tabname alcatel_cell_established_phase_tch_month

tabname alcatel_cell_external_directed_retry_week

tabname alcatel_cell_handover_sdcch_intra_day

tabname alcatel_cell_handover_sdcch_outgoing_month

tabname alcatel_cell_handover_sdcch_per_cause_week

tabname alcatel_cell_handover_tch_incoming_raw

tabname alcatel_cell_handover_tch_month

tabname alcatel_cell_handover_tch_per_cause_1_month


NOTE: Please do note to source your environment before running the above, so that you have access to the Informix Database.



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

728x90
728x90

Problem(Abstract)

This article describes how to calculate space used for each table and dbspace, including how many extents are used and allocated.

Resolving the problem

Q. How do I calculate how much space is used on my instance?

A. You can use a SMI query to calculate how much space is used.

Note, however, that the output will only be accurate if you run update statistics HIGH for each table before running the query.


select  n.dbsname[1,20],
        n.tabname[1,20],
        count(*) no_extents,
        round(t.rowsize * t.nrows / 2048,0) used,
        sum( pe_size) allocated
from    sysmaster:systabnames n, sysmaster:sysptnext p, systables t
where   n.partnum = p.pe_partnum
and     n.partnum = t.partnum
and     t.tabtype = "T"
group by 1,2,4
order by 3 desc , 5 desc;

Note: This SQL assumes that you are using 2048 page size.


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

728x90
728x90

Question

Is there a Sysmaster query for determining additional extents availble per table/index?

Cause

Here is a simple method to see information about additional extents, extent size and next size. The query can be easily modified to show the information for specific tables or dbspaces.

With this query you can avoid reaching Error -136 ISAM error: no more extents.

Answer

SET ISOLATION TO DIRTY READ;

SELECT dbsname as dbname,
tabname as dbobject,
TRUNC((pg_frcnt/8),0) additional_extents,
count(*) num_of_extents,
sum( pe_size ) total_size,
ti_nptotal pages_allocated,
ti_npused pages_used,
ti_npdata data_pages,
ti_nrows data_rows,
ti_rowsize as row_size,
ti_fextsiz first_extent_size,
ti_nextsiz next_extent_size,
hex(partnum) partnum
FROM systabnames, sysptnext, systabinfo, syspaghdr
WHERE
dbsname != "HASHTEMP"
AND tabname not like "sys%"
AND partnum = pe_partnum
AND partnum = ti_partnum
AND pg_partnum = ((TRUNC(partnum/1048576,0)*1048576)+1)
AND pg_pagenum = (partnum-(TRUNC(partnum/1048576,0)*1048576))
GROUP BY 1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13
ORDER BY 3 asc, 4 desc;


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

728x90
728x90

Syntax

This statement is an extension to the ANSI/ISO standard for SQL. You can use this statement only with DB-Access.

Read syntax diagramSkip visual syntax diagram
>>-INFO--+-TABLES-------------------------+--------------------><
         '-+-+-COLUMNS-+----+--FOR--table-'   
           | +-INDEXES-+    |                 
           | '-STATUS--'    |                 
           +-+-PRIVILEGES-+-+                 
           | '-ACCESS-----' |                 
           '-+-FRAGMENTS--+-'                 
             '-REFERENCES-'                   

Usage

The INFO TABLES statement lists the names of all the user-defined tables in the current database. Other keywords that can immediately follow the INFO keyword instruct DB-Access to display various attributes of the table whose name follows the FOR keyword. To display information from more than one keyword option, issue multiple INFO statements.

The keyword options that the INFO statement supports can display the following information:

  • TABLES Keyword

    Use TABLES (with no FOR clause) to list the identifier of every table in the current database, not including system catalog tables. Each user-defined table is listed in one of the following formats:

    • If you are the owner of the cust_calls table, it appears as cust_calls.
    • If you are not the owner of the cust_calls table, the authorization identifier of the owner precedes the table name, such as 'june'.cust_calls.
  • COLUMNS Keyword

    Use COLUMNS to display the names and data types of the columns in the specified table, showing for each column whether NULL values are allowed.


  • INDEXES Keyword

    Use INDEXES to display the name, owner, and type of each index of the specified table, the clustered status, and listing the indexed columns.


  • FRAGMENTS Keyword

    Use FRAGMENTS to display the fragmentation strategy and the names of the dbspaces storing the fragments of a fragmented table. If the table is fragmented with an expression-based distribution scheme, the INFO statement also shows the expressions.


  • ACCESS or PRIVILEGES Keyword

    Use ACCESS or PRIVILEGES to display the discretionary access privileges currently held by users, roles, and the PUBLIC group for the specified table. (These two keywords are synonyms in this context.)


  • REFERENCES Keyword

    Use REFERENCES to display the References access privilege for users who can define referential constraints on the columns of the specified table. For database-level privileges, use a SELECT statement to query the sysusers system catalog table.


  • STATUS KeywordUse STATUS to display information about the owner, row length, number of rows and columns, creation date, and the status of audit trails for the specified table.

An alternative to using the INFO statement of SQL is to use the Info command of the SQL menu or of the Table menu of DB-Access to display the same and additional information.


http://publib.boulder.ibm.com/infocenter/idshelp/v115/topic/com.ibm.sqls.doc/ids_sqs_0859.htm?

728x90

+ Recent posts