12.10 has some fantastic new features with some getting more ‘press’ than others. Those that don’t make the ‘spot light’ are often the more useful general day-to-day DBA utility belt features. Automatic Environment is one such feature.
This article will explain the feature and give some examples of when, where and how to use it.
This feature is only available on Unix platforms , sorry Windows folks but you are out of luck this time.
When and Where
Working with the Informix Database Server product requires first setting some environment variables , typically INFORMIXDIR , INFORMIXSERVER , ONCONFIG and PATH . There maybe others but those are the bare essential ones. These are often saved in a ‘shell environment’ file and ‘sourced’ when needed. Now depending on your shell of choice these are either c-shell scripts , bourne shell , korn shell , bash , zsh and the list goes on. If you have multiple instances then typically there is one ‘environment’ script for each instance . Ok so far not a big deal , but what happens if DBA1 likes using korn shell , whereas DBA2 likes c-shell – that’s 2 sets of scripts to maintain and that’s when problems can start to happen if they become out of sync . Another issue is remote invocation , for example I’m logged in on machineA but want to run a onstat command on machineB . Unless I’ve done some previous scripting work this can be hard to get the right environment on the remote machine this again could lead to some potential disasters like taking down your main production server when you really meant to take down your demo instance .
Here’s where the Automatic Environment feature comes in , yes there is some initial setup required , but once that’s done everyone will be on the same ’2K page’. In essence the automatic environment feature allows a DBA to invoke an Informix command line utility and specify on that invocation where to get the environment from. This is done by passing “-FILE=” as the first argument. eg: /opt/ibm/informix/bin/onstat -FILE=/path/to/instance.env -g ath .
We have already seen an example command line of how to invoke an Informix command line utility using the -FILE= argument but what is the format of this file ?
The format of the file is fairly specific and any deviation from the format will not produce desired results . It’s similar to existing ‘environment’ files.
The format is :
So each environment variable name gets its own line.
Here is an example file that sets the INFORMIXSERVER and ONCONFIG environment variables.
So whats with the ‘#$’ prefix ? Well IBM Informix recommends that you put these in your onconfig file and use that file as a source for the environment. In the onconfig file these would appear as comments ‘denoted by the #’ and the ‘$’ allows for recognition of an environment variable. You do not however have to use the onconfig file.
One other thing to mention is the detection of INFORMIXDIR . When invoking a command with the -FILE= option and the INFORMIXDIR is not set either by the existing environment or set within the FILE , the utility will try to ‘auto set’ it based on the PATH of the command with the assumption that it is in a sub directory of INFORMIXDIR . Heres an example :
Specifying full path to binary :/opt/IBM/informix/bin/onstat -FILE=/opt/IBM/informix/etc/onconfig.myserver -g ath
If INFORMIXDIR is not set then the onstat command will ‘auto set’ it to : /opt/IBM/informix because that is the upperlevel path of where onstat is located.
No PATH ( The assumption here that PATH contains the $INFORMIXDIR/bin )onstat -FILE=/myinstances/envfiles/instanceA -g ath
So if onstat resides in /products/informix1210/bin INFORMIXDIR will be ‘auto set’ to /products/informix
This makes running Informix commands from remote machines very simple , simply by just using the -FILE= argument .
consider :ssh myhost:/opt/IBM/informix/bin/onstat -FILE=/instances/envfiles/instanceA -g ath
The above will run onstat -g ath on the instance located on the machine myhost with the environment taken from /instances/envfiles/instanceA
With some simple shell scripting you could get all the sql running on all your servers from a single machine .ssh reportshost:/opt/IBM/informix/bin/onstat -FILE=/instances/env/instanceA -g sql ssh productionhost:/opt/IBM/informix/bin/onstat -FILE=/instances/env/prodInstance -g sql ssh demohost:/opt/IBM/informix/bin/onstat -FILE=/instances/env/demoInstance -g sql
As you can see from this simple feature there are tremendous possibilities for enhancing your workflow. Give it a try .
Does the OpenAdmin Tool not quite provide the information you need ? Well , if the answer to that is yes , this article is for you.
This is a great IBM Developer-works article about creating plugins for OAT . It’s specifically about archive history but provides a great overview of making plugins.
Plugins are are a fantastic feature in OAT and are pretty simple to use , take a look at the article and use it as a template to create your own.
Ever been frustrated that Informix doesn’t do something that you’d really like it to do ?
That ‘if only’ moment that leads to excessive hair pulling and cursing at the screen !
Well stress no more as IBM have added the Informix family of products to its ‘Request For Enhancement’ system.
What does this mean ?
It means that you can now request new features / enhancements to the Informix product line simply and easily. There is no guarantee that your request will be implemented or in what time frame but its still a great opportunity to put your ideas forward and influence the products future direction.
Whats really nice about the system is its simplicity , just visit http://ibm.com/developerworks.com/rfe select Information Management under ‘Brands’ and then you can browse , submit or vote on RFE’s .
So why are you still here , go add those requests now !