UNIX korn shell template that defines multiple IBM® Informix® Dynamic Server™ environments

Technote (troubleshooting)


This document presents a generic Unix Korn shell environment for use in conjunction with multiple IBM® Informix® Dynamic Server™ instances defined on one server , as can also serve as a template in creating your own customized database environment shell scripts.

Resolving the problem


The DBA understands the importance of having a correct environment for accessing the database. When there are multiple databases (or instances) on a server it is useful to be able to switch quickly and efficiently between environments. Included is a Generic Unix Korn shell script which provides this capability, as well as several useful functions for managing one or more IBM® Informix® Dynamic Server™ instances defined on a single server.


1. Create separate environment files for each instance.

Each instance is defined by the following environment variables.


Insert these variables with appropriate values into separate files for each instance.

Example: Here is an example of two Korn shell files called inf1.ksh and inf2.ksh.

    #Begin file inf1.ksh
    export INFORMIXDIR=/usr/informix/9.40.FC6
    export ONCONFIG=onconfig.test1
    export LD_LIBRARY_PATH=/usr/lib:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql
    export INFORMIXSERVER=ese1_tcp
    export PATH=$INFORMIXDIR/bin:/usr/bin:/usr/ucb
    #End file inf1.ksh

    #Begin file inf2.ksh
    export INFORMIXDIR=/usr/informix/10.00.UC1
    export ONCONFIG=onconfig.test2
    export LD_LIBRARY_PATH=/usr/lib:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql
    export INFORMIXSERVER=ese2_tcp
    export PATH=$INFORMIXDIR/bin:/usr/bin:/usr/ucb
    #End file inf2.ksh

    Note: Other variables can be put in these files.

2. Add these files to the included Korn shell script.

Edit the included informix.ksh file and assign these file names for these source files into the ENVLIST array variable. Note the location of the source files, ENVDIR, is set to HOME, however any directory can be used.

Example: The above environment files are added to the informix.ksh script.

    export ENVDIR=$HOME
    set +A ENVLIST $ENVDIR/inf1.ksh  $ENVDIR/inf2.ksh

In this example there are two source files defining two instances.

3. Source the informix.ksh file into your environment.

This can be done with the <dot> command like:

    . .informix.ksh

After sourcing the informix.ksh file you will now have several shortcuts to common database commands defined in your environment: You can however edit informix.ksh and modify these to any shortcut you wish to use.

    swi:         Switch between instances.
    swda:        Select a default database (DBNAME) in the current instance
                  (Used in the dba and dbs commands)
    inf_env:     Output the current Informix environment settings.
    dba:          Alias for dbaccess $DBNAME.
    dbs:         Alias for dbschema -d $DBNAME.
    doall <command>:   Run <command> in each environment defined by ENVLIST
    shutall:     Shut down all instances.
    startall:     Start all instances.
    rebootdb:    Shutdown then startup all instances.
    cdi:          Change directory to INFORMIXDIR.
    vcf:          Edit the ONCONFIG file.
    vlog:         View the Online Message Log.
    tlog:         Tail the Online Message Log.
    vsq:          Edit the sqlhosts file.

The DBA or other authorized user(s) can insert additional database/unix commands as desired.


The following products and operating systems can be used in conjunction with this template:

Product Name
Product Version(s)
Hardware Vendor
Operating System
IBM® Informix® Dynamic Server™
All Unix Based
All Unix Based
x can be U, H, or F depending on your operating system.

Rate this page:

(0 users)Average rating

Add comments

Document information

More support for:

Informix Servers

Software version:

7.2, 7.3, 9.2, 9.3, 9.4, 10.0

Operating system(s):

AIX, HP-UX, Solaris

Reference #:


Modified date:


Translate my page

Machine Translation

Content navigation