0

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.

1 Answer 1

2

Use the db2greg command:

db2greg -dump
1
  • Above command returns several info, but it is excellent point. Above command returns several rows and columns delimitered by comma. To get instance names in output from above command it is required to return fourth column when filtering first column with "I" and second column with "DB2" where column delimiter is comma. Like: db2greg -dump | gawk -F, '$1=="I" && $2="DB2" {print $4}'
    – folow
    Apr 19 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.