Chandru
Chandru

Reputation: 336

database not listed in DB2

I have some databases on DB2 on an AIX server.

I login as the DB2 instance user id "chandroo" (having the db2profile set automatically when i login) and issue a command as below and get no result.

chandroo@xxxxxxxx::/db2/chandroo> db2 list db directory
chandroo@xxxxxxxx::/db2/chandroo>

However if I invoke the db2 directly from the installation directory I am able to see the entries , and I have no clue as to why it happens.

chandroo@xxxxxxxxx::/opt/IBM/db2/V9.5/bin> ./db2 list db directory

 System Database Directory

 Number of entries in the directory = 2

Database 1 entry:

 Database alias                       = CHANDB
 Database name                        = CHANDB
 Local database directory             = /db2/chandroo/db
 Database release level               = c.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

Database 2 entry:

 Database alias                       = CHAN
 Database name                        = CHAN
 Local database directory             = /db2/chandroo/db
 Database release level               = c.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

chandroo@xxxxxxxxx::/opt/IBM/db2/V9.5/bin>

Upvotes: 0

Views: 1121

Answers (1)

Fred Sobotka
Fred Sobotka

Reputation: 5332

It sounds like the db2profile script isn't being sourced properly. The environment variables defined in that script need to be set for your current AIX shell process, not a temporary subprocess started by sh, ksh, or bash. This is accomplished by specifying a single dot instead of a program name to run the db2profile script. The difference is subtle, but important.

If that is the problem, running this command will fix the problem by properly initializing your current shell process:

. ~chandroo/sqllib/db2profile

and commands like db2 list db directory will start working.

The next step is to determine what is keeping that from happening in your $HOME/.profile startup script. If you see the call to db2profile using the proper syntax as shown above, there might be a problem with the execution permissions on $HOME/.profile.

Upvotes: 2

Related Questions