Db2 – error when trying to connect to remote db2 luw database on linux

db2linux

I have a db2 client on my local linux machine:

alok@hostname:~$ uname -a
Linux hostname 3.2.0-53-generic #81-Ubuntu SMP Thu Aug 22 21:01:03 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
alok@hostname:~$ db2

(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 10.5.0

You can issue database manager commands and SQL statements from the command 
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside 
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 => 

There is a db2 installation on another machine on the network:

[dbadm@dbserver ~]$ uname -a
Linux dbserver 2.6.32-131.0.15.el6.x86_64 #1 SMP Tue May 10 15:42:40 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
[dbadm@dbserver ~]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 10.1.2

You can issue database manager commands and SQL statements from the command 
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside 
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 => list database directory

 System Database Directory

 Number of entries in the directory = 5

Database 1 entry:

 Database alias                       = TEST
 Database name                        = TEST
 Local database directory             = /home/dbadm
 Database release level               = f.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

Database 2 entry:

 Database alias                       = TESTDB2
 Database name                        = TESTDB2
 Local database directory             = /home/dbadm
 Database release level               = f.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

Database 3 entry:

 Database alias                       = TEST2
 Database name                        = TEST2
 Local database directory             = /home/dbadm
 Database release level               = f.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

Database 4 entry:

 Database alias                       = TESTDB15
 Database name                        = TESTDB15
 Local database directory             = /home/dbadm
 Database release level               = f.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

Database 5 entry:

 Database alias                       = SAMPLE
 Database name                        = SAMPLE
 Local database directory             = /home/dbadm
 Database release level               = f.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = -1
 Alternate server hostname            =
 Alternate server port number         =

db2 =>

Now I am trying to connect to this instance remotely. The first step, I am told, is to catalog the server on the client.

alok@hostname:~$ db2 catalog tcpip node dbremote remote 192.168.5.6 server dbadm 
SQL1092N  The requested command or operation failed because the user ID does 
not have the authority to perform the requested command or operation.  User 
ID: "ALOK".

(192.168.5.6 is the ip corresponding to the hostname dbserver )

So there is something else the catalog command expects, and I don't know what. What is it?

Best Answer

The DBMS tells you, that you (the user ALOK) don't have the authority to catalog a database. You need to be SYSADM or SYSCTRL for performing such a task.

You can use the table function AUTH_LIST_AUTHORITIES_FOR_AUTHID to find out which authorities your user has.

If you installed the db2 client on your computer, you should be able to change the user to SYSADM (try su - name_of_sysadm).

For cataloging database remotely via tcpip, you also have to do several tasks to activate tcp/ip communication and so on. Please read about it in DB2 Information Center