Find Database Names from a Script

The DBA sometimes needs to be able to run scripts or programs that will take an action on every database in an OnLine instance. An example would be if the DBA wanted to do some reports of space utilization by database. Another example would be running an UPDATE STATISTICS command in SQL for all databases. OnLine does not make it easy to do this. The information is readily available, since isql asks you to choose a database before you do any work from the menu, but there is no simple and straightforward way I know to do this from a script.

In this case, we need to take the brute force approach. This information is available in the tbcheck -pe output as part of the fully qualified table names. The following script, named find_db_names, will output the names of your databases:

$INFORMIXDIR/bin/tbcheck -pe |grep systables | grep -v WARNING | tr ":" " " | awk '{print $1}'
sort -u

This script is pretty slow, and it's certainly an awkward approach, but it works. Since it uses tbcheck -pe, it does not lock up any tables and can be run with no danger to an operating Informix system.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.30.232