Posted by nick @ 15:47 on September 9th 2013

Simulating a logon trigger in DB2 LUW 9.7 and later

Here’s a nice post by Serge Rielau on how to implement a “logon trigger” in DB2 LUW 9.7 and later using a stored procedure and the CONNECT_PROC database configuration parameter.

The CONNECT_PROC parameter is one of those obscure but very useful features that I wish more people knew about.

Posted by nick @ 19:32 on September 8th 2013

Automatic startup and shutdown of DB2 instances on Linux

The default approach to enabling automatic startup of DB2 instances on Linux operating systems relies on the DB2 Fault Monitor. During the installation a line like this:

fmc:2345:respawn:/opt/IBM/db2/V8.1/bin/db2fmcd #DB2 Fault Monitor Coordinator

is added to the /etc/inittab file. The fault monitor then takes care of starting and restarting the instances which were enabled for autostart by db2iauto on.

There seem to be several problems with that approach. Firstly, the use of /etc/inittab to start programs is deprecated in the modern Linux versions. Secondly, one may want to have a more flexible tool to manage the lifecycle of DB2 instances on the system, such as that provided by the System V init scripts.

I’ve created a couple of scripts — one for the Red Hat Linux, another for SuSE — that can be used in place of the default startup control. They can be downloaded from GitHub.

The installation is easy: drop the appropriate for your server version of the script into /etc/init.d, naming it “db2″. Change the file permissions to allow execution. Run chkconfig --add db2 to enable it.

At this point the scripts respond to three commands: start, stop, and status.

The start command causes the script to check all instances listed in the DB2 global registry file and start those for which the startatboot flag is set to “1″.

The stop command, on the other hand, will stop all running DB2 instances, regardless of their startatboot flag value.

To modify the flag you can use the command:

db2greg -updinstrec instancename=db2inst1!startatboot=0

Obvisously, you’ll need to replace “db2inst1″ with your instance name. Set the flag to “1″ to enable autostart; set it to “0″ to disable it.

For more information on the global registry file and the db2greg utility check the manual, as always. Running db2greg -h also provides much useful information.

Posted by nick @ 13:27 on March 14th 2013

Column-organized tables in DB2? Why not! Check out the IBM DB2 Technology Preview

A technology preview program for the potential new features in IBM DB2 was announced today: IBM DB2 Technology Preview

You can explore what DB2 developers are working on and provide direct feedback. In this installment: column-organized tables, a feature that may benefits performance of analytical and other data warehouse-type workloads.

In a column-organized table values of a single table column are stored sequentially in a particular page on disk. This is contrary to the regular, row-organized tables, where all columns of each row are stored sequentially, and one or more complete rows are placed on a particular page.

Columnar organization of a table benefits queries that access a significant portion or all rows in the table but only reference few columns.

Of course, there is no certainty about when or even whether this will actually be a part of DB2 Data Server, but the technology preview program gives you the opportunity to influence future directions of DB2.

Posted by nick @ 17:53 on September 19th 2012

Populate a DB2 database table with pseudo-random BLOBs

How do we quickly populate a database table with arbitrary LOB data? This question often comes up when we need to generate some data for performance testing or tuning. We can, of course, write a little utility in our favourite programming language, such as Java or Perl.

The Java approach can be found in DB2 documentation, for example, here. It shows a stored procedure, but we can see how this idea can be used in a standalone application as well. All we need to do now is write the code, compile it hoping there are no errors (as if!), and wait while a few hundred thousand of LOBs get inserted over a JDBC connection. Fun!

But is there a quicker way? How about three simple Bash commands? (more…)

Posted by nick @ 16:06 on December 22nd 2011

Security Bulletin: DB2 Escalation of Privilege Vulnerability

A vulnerability has been found in the Tivoli Monitoring Agent (ITMA) that ships with DB2 9.5 and 9.7. It allows a local user to run arbitrary code with elevated (root) privileges.

If you are using ITMA, take a note of how to apply the workaround:

Apparently, the Response File Generator utility, db2rspgn, is also affected:

Next Page »