db2 – how to get list of all of the Db2 instances on computer

Posted on

Question :

I have several Linux servers and on them may be one or more Db2 instances. Db2 instances can be from different Db2 versions.

For security audit I need to write some simple bash script to check for some “dbm cfg” settings on all Linux servers. I have some tool that allows me to connect to Linux servers with root access and then I am able to execute any bash command on remote Linux server.

QUESTION: What I am having a problem is, how to get the list of Db2 instances on Linux server with root user without knowing the Db2 instance owners or Db2 instance names?

When I get the owners I can “sudo” or “su” to that Db2 instance owner Linux user and execute “db2 get dbm cfg” command.

Answer :

Use the db2greg command:

db2greg -dump

Leave a Reply

Your email address will not be published. Required fields are marked *