Informix Quick Start Guide



A no frills step by step guide for installing, initializing and administering Informix based on the things I'm blogging about.  The title states Innovator-C specifically, but most everything I talk about here will pertain to all versions of Informix.  New content will be added over time as new topics are discussed in my blog.


In this guide I will:

  • Install 32-bit Informix 11.50.UC7IE Innovator-C Edition on Linux on a server named blogsvr01
  • Use cooked chunks (filesystem files for data vs. raw disk)
  • Initialize an engine named blogsvr01 on a server named blogsvr01 with 2 GB root dbspace which includes a 1 GB physical log
  • Configure 2 GB of logical log space made up of 16 131064 KB logical logs
  • Configure System and Logical Log backups using ontape to directories
  • Perform a Cold Restore of the last Level 0 backup and applying the Logical Log backups
  • Add a 4GB dbspace for data and indexes
  • Optionally add a 4GB chunk to existing dbspace


Installing Informix

Original Blog Post: Installing Innovator-C on Linux

End result: Informix installed

1. Download Informix Innovator-C from IBM Informix Downloads page

2. Create the informix group and informix user

root> groupadd informix
root> useradd -g informix -m informix
root> passwd informix

3. Create INFORMIXDIR

root> mkdir /opt/informix-ids-11.50.UC7IE
root> chown informix:informix /opt/informix-ids-11.50.UC7IE
root> ln -s /opt/informix-ids-11.50.UC7IE /opt/informix

4. Setup environment variables

root> vi /etc/profile.d/informix.sh

# location of informix install
export INFORMIXDIR=/opt/informix

# add $INFORMIXDIR/bin to PATH for easy execution of Informix commands
export PATH=${INFORMIXDIR}/bin:${PATH}

# I still like to set this env variable even tho we used the default location
export INFORMIXSQLHOSTS=${INFORMIXDIR}/etc/sqlhosts

# the name of our Informix instance, matches sqlhosts and DBSERVERNAME in ONCONFIG
export INFORMIXSERVER=blogsvr01

# define the config filename
export ONCONFIG=onconfig.${INFORMIXSERVER}

5. Change to a temporary directory that holds the tarball from step 1 and untar

root> cd /root/tmpinfinstall
root> tar -xvf iif.11.50.FC7IE.Linux-RHEL4.tar

6. Run the Informix install script ids_install.  This will install the engine, the CSDK and JDBC.  Answer n when asked to run in GUI mode, accept the License Agreement and accept the defaults for everything else

root> . /etc/profile.d/informix.sh 
root> ./ids_install


Initializing the Engine


Original Blog Post: Initializing Informix Innovator-C on Linux

End Result:
  • Informix engine initialized and running
  • 2 GB root dbspace
  • 1 GB physical log in the root dbspace
Notes:
1. Create the chunks directory in a partition that has enough space to hold your data

informix> mkdir /home/informix/chunks

2. Create the rootdbs chunk named ROOTDBS.01

informix> touch /home/informix/chunks/ROOTDBS.01
informix> chmod 660 /home/informix/chunks/ROOTDBS.01

3. Create the sqlhosts file

informix> vi $INFORMIXSQLHOSTS

# sqlhosts field definitions
# field 1 - DBSERVERNAME
# field 2 - network protocol, onsoctcp is for socket based TCP
# field 3 - hostname or ip address of server running the engine
# field 4 - port number or service from /etc/services
# field 5 - optional options

# blogsvr01 
blogsvr01   onsoctcp    blogsvr01   idstcp01

4. Create ONCONFIG file and change ROOTPATH, ROOTSIZE, PHYSFILE and DBSERVERNAME

informix> cp $INFORMIXDIR/etc/onconfig.std $INFORMIXDIR/etc/$ONCONFIG
informix> vi $INFORMIXDIR/etc/$ONCONFIG

ROOTPATH /home/informix/chunks/ROOTDBS.01
ROOTSIZE 2097152
PHYSFILE 1048576
DBSERVERNAME blogsvr01

5. Add idstcp01 port to /etc/services

root> vi /etc/serivces

idstcp01         1526/tcp          # Informix

6. Initialize the engine

informix> oninit -iv


Configure Logical Logs

Original Blog Post: Blogging About Logging - Informix Physical and Logical Logging

End Result:
  • 2 GB llogdbs01 dbspace
  • 16 131064 KB logical logs created in llogdbs01 dbspace
  • Remove 6 logical logs created during initialization
1. Temporarily set LTAPEDEV to /dev/null and bounce the engine

informix> vi $INFORMIXDIR/etc/$ONCONFIG

LTAPEDEV /dev/null

informix> onmode -k
informix> oninit -v

2. Create a new dbspace called llogdbs01 to hold the new logical logs

informix> touch /home/informix/chunks/LLOGDBS01.01
informix> chmod 660 /home/informix/chunks/LLOGDBS01.01
informix> onspaces -c -d llogdbs01 -p /home/informix/chunks/LLOGDBS01.01 -o 0 -s 2097152

3. Make logical log 4 the current logical log and put the last checkpoint in logical log 4

Execute onmode -l multiple times until the output for logical log 4 in onstat -l shows 'C' in flags

informix> onmode -l # repeat as necessary
informix> onmode -c

4. Drop logical logs 1, 2 and 3

informix> onparams -d -l 1 -y
informix> onparams -d -l 2 -y
informix> onparams -d -l 3 -y

5. Create 3 new logical logs

informix> onparams -a -d llogdbs01 -s 131064
informix> onparams -a -d llogdbs01 -s 131064
informix> onparams -a -d llogdbs01 -s 131064

6. Move the current logical log and last checkpoint out of logical logs 4, 5 and 6

informix> onmode -l
informix> onmode -l
informix> onmode -l
informix> onmode -c

7. Drop logical logs 4, 5 and 6

informix> onparams -d -l 4 -y
informix> onparams -d -l 5 -y
informix> onparams -d -l 6 -y

8. Create logical logs 4 through 16

informix> onparams -a -d llogdbs01 -s 131064 # repeat 12 times


Configure System Backups to a Directory

Original Blog Post: Informix Backup and Restore

End Result: System Backups written to /home/informix/backup/system

1. Create a directory to hold the System Backups

informix> mkdir /home/informix/backup
informix> mkdir /home/informix/backup/system
informix> chmod 770 /home/informix/backup/system

2. Change ONCONFIG TAPEDEV parameter to new backup directory

informix> vi $INFORMIXDIR/etc/$ONCONFIG

TAPEDEV /home/informix/backup/system

3. Optionally compress System Backups

informix> vi $INFORMIXDIR/etc/$ONCONFIG

BACKUP_FILTER /bin/gzip
RESTORE_FILTER /bin/gunzip

4. Take a Level 0 System Backup

informix> ontape -s -L 0 -d


Configure Automatic Logical Log Backup to a Directory

Original Blog Post: Informix Backup and Restore

End Result: Automatic Logical Log backups written to /home/informix/backup/llog

1. Create a directory to hold the Logical Log backups

informix> mkdir /home/informix/backup/llog
informix> chmod 770 /home/informix/backup/llog

2. Change ONCONFIG LTAPEDEV parameter to new backup directory

informix> vi $INFORMIXDIR/etc/$ONCONFIG

LTAPEDEV /home/informix/backup/llog

3. Optionally change ONCONFIG LTAPESIZE parameter if backup and restore filters are used

informix> vi $INFORMIXDIR/etc/$ONCONFIG

LTAPESIZE 2097152

4. Modify $INFORMIXDIR/etc/alarmprogram.sh to enable automatic logical log backups with ontape

informix> vi $INFORMIXDIR/etc/alarmprogram.sh

# line 31, change flag from N to Y
BACKUPLOGS=Y

# line 62, change onbar -b -l to ontape -a -d
BACKUP_CMD="ontape -a -d"

5. Test by forcing a logical log switch

informix> onmode -l

All used logical logs except for the current logical log should be backed up.  Verify by checking for a flag of 'B' in onstat -l output, monitoring the Informix log via onstat -m and checking the logical log backup directory for logical log backups.


Restoring from System Backup and Applying the Logical Log backups

Original Blog Post: Informix Backup and Restore 


End Result: Informix engine restored to most recent point in time available

1. Verify the engine is offline

informix> onstat -
shared memory not initialized for INFORMIXSERVER 'blogsvr01'

2. Verify chunks required for restore exist, recreate using touch command if necessary

informix> ls -l /home/informix/chunks

total 4194312
-rw-rw---- 1 informix informix 2147483648 2010-07-26 12:35 LLOGDBS01.01
-rw-rw---- 1 informix informix 2147483648 2010-07-26 12:35 ROOTDBS.01

informix> touch /home/informix/chunks/DATADBS01.01 # assuming we need a chunk named DATADBS01.01 and it does not exist
informix> chmod 660 /home/informix/chunks/DATADBS01.01
informix> ls -l /home/informix/chunks
total 4194312
-rw-rw---- 1 informix informix          0 2010-07-26 12:38 DATADBS01.01
-rw-rw---- 1 informix informix 2147483648 2010-07-26 12:35 LLOGDBS01.01
-rw-rw---- 1 informix informix 2147483648 2010-07-26 12:35 ROOTDBS.01

3. Execute a ontape restore from directory

informix> ontape -r -d

4. Bring the engine into Multi-User mode from Quiescent mode

informix> onmode -m 

Create a Dbspace for Data and Indexes

Original Blog Post:  Creating Dbspaces, Databases, Tables and Indexes in Informix 

End Result
  • 4GB dbspace created for data and indexes
1. Create a new 4GB dbspace

informix> touch /home/informix/chunks/DATADBS01.01
informix> chmod 660 /home/informix/chunks/DATADBS01.01
informix> onspaces -c -d datadbs01 -p /home/informix/chunks/DATADBS01.01 -o 0 -s 4194304

2. Take a Level 0 backup

informix> ontape -s -L 0 -d


Optionally Add a Chunk to an Existing Dbspace

Original Blog Post:  Creating Dbspaces, Databases, Tables and Indexes in Informix 

End Result
  • 4GB dbspace added to existing dbspace
1. Add a chunk to an existing dbspace

informix> touch /home/informix/chunks/DATADBS01.02
informix> chmod 660 /home/informix/chunks/DATADBS01.02
informix> onspaces -a datadbs01 -p /home/informix/chunks/DATADBS01.02 -o 0 -s 4194304


Stay tuned for more content...