728x90


Problem(Abstract)

This article shows several methods of producing values in minutes from the difference of two datetime values. These examples can also be applied to produce hours and seconds.

Resolving the problem

Q. How can I determine the number of hours, minutes or seconds difference between two datetime values?


A. This can be accomplished with SQL using the following methods:

  • The following SQL script uses a temp table to calculate the number of minutes difference between col1 and col2. This method works with any version of IBM® Informix® Dynamic Server (IDS):
      create temp table tmp_dt_tab 
      ( 
        col1 datetime year to second, 
        col2 datetime year to second, 
        col3 interval minute(9) to minute 
      ) with no log;
      insert into tmp_dt_tab values (CURRENT YEAR TO SECOND, "2001-09-11 12:00:00", NULL);
      update tmp_dt_tab set col3 = (col1 - col2);


  • The following SQL script uses an interval to implicitly cast into minutes the difference between the current datetime and noon on 9/11/2001. This method works with any version of IDS:
      select interval(0) minute(9) to minute + 
             (current year to minute - "2001-09-11 12:00") 
        from systables 
       where tabid = 99;


  • The following SQL script explicitly casts into minutes the difference between the current datetime and noon on 9/11/2001. This method requires IDS version 9.x or 10.x:
      select (current year to minute - 
              "2001-09-11 12:00")::interval minute(9) to minute 
        from systables 
       where tabid = 99;


  • The following SQL script explicitly casts into minutes the difference between the current datetime and noon on 9/11/2001. This method requires IDS version 9.x or 10.x:
      select cast ((current year to minute - "2001-09-11 12:00") as 
                    interval minute(9) to minute) 
        from systables 
       where tabid = 99;


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

    728x90
    728x90


    Problem(Abstract)

    This article describes a method to find the IBM Informix Dynamic Server configuration file settings.

    Resolving the problem

    INTRODUCTION

    The values in the onCONFIG configuration file may not be the settings current in effect by the database server. This is true when:

    • One of the parameters in the file is changed after the database server is started
    • A parameter has been changed dynamically with the onparams utility
    • A parameter that has been change dynamically with the onmode utility


    You can find out what configuration parameters the database server is currently using by running an SQL query against the sysmaster database. 


    BEFORE YOU BEGIN 

    The database server must be running. 


    STEPS 

    1. Start an application that allows you to make queries on the database server (dbaccess, for example). 

    2. Connect to the sysmaster database on the database server. 

    3. Execute this SQL: 
      SELECT cf_name, cf_default, cf_effective, cf_original FROM   syscfgtab;

    Each row returned in the output represents one configuration parameter. Here is a definition of each of the columns: 

    Column name
    Meaning
    cf_name
    This is the parameter name.
    cf_default
    This is the default value if no valid value is present in the onCONFIG file.
    cf_effective
    This is the current value of the parameter.
    cf_original
    This is the value the parameter had when the database server was started.


    728x90
    728x90


    Problem(Abstract)

    How to get the version of Informix JDBC driver without writing any code

    Resolving the problem

    INTRODUCTION

    Most customers using Informix products are used to having an option which gives them the version of the product being used. This is usually done at the command line using the "-V" option or using a special utility.

    For example: esql -V would give the version of esql or the utility ifx_getversion can be used to display the version of the ClientSDK.

    It is also possible to obtain the version of the JDBC driver contained in the ifxjdbc.jar file from the command line.


    BEFORE YOU BEGIN

    Make sure you have set the CLASSPATH variable correctly to include the location of ifxjdbc.jar ( or ifxjdbc-g.jar ) and that your PATH has the JDK in it.


    STEPS

    Execute the following

      java com.informix.jdbc.Version

    The following examples shows sample output. 
      % java com.informix.jdbc.Version 
      IBM Informix JDBC Driver Version 2.21.JC5


    COMMON PROBLEM 

    Symptom : 
    Exception in thread "main" java.lang.NoClassDefFoundError: com/informix/jdbc/Version 

    Resolution: 
    Make sure that ifxjdbc.jar is in your CLASSPATH. If you see ifxjdbc.jar in the CLASSPATH, make sure that ifxjdbc.jar exists in the location specified.


    e. set CLASSPATH=c:\informix\ifxjdbc.jar



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

    728x90
    728x90


    Question

    SQL to find list of the tables in a particular chunk

    Answer

    To obtain a list of the tables in a particular chunk, below sql can be used:
    select dbinfo( "DBSPACE" , pe_partnum ) dbspace,

    dbsname[1,12],

    tabname,

    pe_chunk,

    pe_offset start,

    pe_size size

    from sysptnext, outer systabnames

    where pe_partnum = partnum

    and pe_chunk = <chunk number>

    order by start, dbsname, tabname;

    Replace chunk number with the number of the chunk for which you want to list the table names.



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

    728x90
    728x90

    Question

    What are the chunk limitations in Informix Dynamic Server (IDS) and Extended Parallel Server (XPS)?

    Answer

    The IBM Informix® database servers have different limitations on the number of chunks and the maximum chunk size.

    The following table shows the maximum number of chunks and the maximum chunk size that the IBM Informix onLine (OnLine), IBM Informix Dynamic Server (IDS), and IBM Informix Extended Parallel Server (XPS) database servers can create.

    Version
    Number of chunks
    Maximum Chunk Size
    OnLine 5.x 
    with 2KB pages
    Varies from 12 
    to about 50 
    (see below)
    2GB
    OnLine 5.x 
    with 4KB pages
    Varies from 26 
    to about 100 
    (see below)
    2GB
    XPS 8.1x and 8.2x
    32767
    2GB
    XPS 8.3, 8.4, and 8.5x
    32767
    1 TB
    IDS 7.x
    2047
    2GB
    IDS 9.1, 9.2, and 9.3
    2047
    2GB
    IDS 9.4/IDS 10.0
    32766
    2 Billion Pages


    Number of chunks in onLine 5.x 

    In onLine 5.x a data page is used to store information about the chunks. 28 bytes of the page are used for various structures. Out of the memory left, each chunk uses up 28 bytes plus one byte for every character in the complete path name of the chunk. So the shorter the full path names of your chunks are the more chunks you can have. 

    The ranges in the table above are based on the maximum allowed path name of 128 characters and a realistic minimum path name length of 12 characters. 


    Units used in this document 

    This document uses the base-two definitions for memory units as follows: 

      KB = kilobyte = 1024 bytes = 2 10  bytes 
      MB = megabyte = 1024 KB = 2 20  bytes 
      GB = gigabyte = 1024 MB = 2 30  bytes 
      TB = terabyte = 1024 GB = 2 40  bytes


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


    728x90
    728x90


    Problem(Abstract)

    To turn on or off the SQL Explain in the IDS engine while SQL is running, use the onmode -Y command.

    The syntax:

    onmode -Y <session id> 2
    onmode -Y <session id> 1
    onmode -Y <session id> 0

    The option with 2 turns SET EXPLAIN on for sessionid and displays the query plan only
    The option with 1 turns SET EXPLAIN on for sessionid
    The option with 0 turns SET EXPLAIN off for sessionid


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

    728x90
    728x90


    Question

    In some onstat/oncheck outputs and systables table there is information about the 'partnum'. What is the 'partnum' and what does it means?

    Answer


    The partition number (partnum) contains information about a table.

    It is 4-byte hexadecimal value (0x12345678) that is composite of two values, the most significant 3 digits indicates which dbspace contains the table (tblspace) and the least 5 significant digits indicates the logical page number that contains information about the table.

    It means that 0x123 indicates which dbspace contains the table and 0x45678 indicates a logical page number that keeps information about the table.

    For example, if the partnum of table customer is 0x0050015f, it means that dbspace 5 (0x005) contains the table and the logical page 0x0015f keeps information about the customer table.

    Note 1: The 'tblsnum' in 'onstat -k' and 'tblnum' in 'onstat -t/-T' corresponds to the part number (partnum) of the table.

    Note 2: The value of partnum stored in systables and reported in oncheck -pt is a decimal value, you need to convert it to hexadecimal in order to get the information of which dbspace contains the table and the logical page that keeps information of the table.


    728x90
    728x90


    Question

    This article describes a method of finding the number of free pages within a table while avoiding locking issues.

    Answer

    You may run into locking issues when running oncheck -pT tablename on a high use table. You can run a query using the sysmaster database instead to avoid encountering locking issues.
    The following select statement from the sysmaster database will provide free page information similar information to oncheck -pt:

    select count(pb_bitmap), pb_bitmap
      from sysptnbit p,systabnames t
     where t.tabname = "tablename"
       and t.dbsname = "databasename"
       and p.pb_partnum = t.partnum
     group by pb_bitmap;

    This select will not place any locks on the base table tablename . The query produces output similar to:

             (count)   pb_bitmap

                2841          12
                 196           0
                  26           4
                   1           8

    4 row(s) retrieved.

    The pb_bitmap column is the decimal value of the bitmap for each page in the table. The values mean the following:

    pb_bitmap Description
    ========= =========
      0       Unused
      4       Data Page with room for another row
      8       Index Page
     12       Full Data Page

    Note: You could use the query to help estimate the number of pages still available within the table. You should estimate on being able to use only 30% of the pages with the value of '4', meaning 'a data page with room for another row'.

    Using the example data: The engine would need another extent after using the remaining space in the partially used pages:
    (26 * 30%) = 7.8 pages


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

    728x90
    728x90


    Question

    Running a query on catalog table 'sysmaster' return tables with a value of zero in the partnum column like this :

    tabname sysdomains
    owner informix
    partnum 0
    tabid 70
    rowsize 167

    Answer


    The partnum column in systables indicates the identification of the table inside a dbspace, when the value of partnum is zero, this means that it is a :

    • fragmented table
    • view
    • synonym


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

    728x90
    728x90

    Problem(Abstract)

    online.log shows sessions getting killed (MCMD_KILL)

    Symptom

    You see messages in online.log. something similar to these:


      04:15:08  sid 2011976 username sanjju@linux12 pid 2566 terminated.
      04:15:08   killed(MCMD_KILL)

     

    Cause

    You will see such messages in online.log when someone kills session(s) either manually, or through some maintenance script, by running onmode -z.


    Other scenarios where we can see these messages in online.log is when informix server kills sessions internally. Situations where server could be killing sessions internally are like, when the server is switching to a single user mode, or when it is shutting down.

    Also, with newer version of Informix server (11.50.xC9, or 11.70.xC4 and higher versions) that supports Low Memory Management feature and has the feature enabled with a defined threshold, you can see sessions getting killed internally after the instance enters the defined threshold for low memory.

    You can run 'onstat -g lmm' and review the output. This should list the sessions, if any were killed due to enabling of low memory management feature. For more information on this command, please check the link given in the "Related Information' section of this document.


     

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

    728x90

    + Recent posts