Catalog a DB2 Database


DB2 Client
Before Cataloging the DB2 the DB2 server or atleast a DB2 client should be installed on the machine
from where we are trying to connect to the DB2 Server
Only on a DB2 Server or a DB2 client can a DB be cataloged
>>Ensure that Atleast a DB2 Client is installed
>>DB2 client is free and doesn’t need any license to be installed
>>DB2 Clients can be downloaded from : https://www-304.ibm.com/support/docview.wss?uid=swg27007053

  • >Ensure to select the same version and FixPack as the servers you’re connecting to.
  • >Then select the proper OS.
  • >Select “IBM Data Server Client”

Prerequisites to Catalog DB2
1) REMOTE: Short host name with proper entry in hosts file OR Fully qualified host name OR IP address
2) SERVER: Port number the db2 server is listening on.
To identify the port no where the DB2 server listening to log into db2 server as the db2instance owner and execute the below command

[db2inst1@mercury ~]$ $ db2 get dbm cfg |grep SVCENAME

3) NODENAME: This is a name that you make up. It can be any name which is logical and easy to understand

====================================================================

Catalog the node

====================================================================
1) Login to the local machine from where you want to connect to remote DB2 Database as
the privileged user who would be connecting and owner of the db2client installation
Execute the below command

db2 catalog tcpip node <NODENAME> remote <REMOTE> server <PORT>

The details of NODENAME, REMOTE and PORT are mentioned above

[db2inst1@mercury ~]$ $ db2 catalog tcpip node PRODDB remote remoteDb2server.domain.com server 60000

====================================================================

Catalog the Database

====================================================================

1) Login to the local machine from where you want to connect to remote DB2 Database as the privileged user who would be connecting and owner of the db2client installation
2) Execute the below command

db2 catalog database <database_name> at node <node_name>

Where database_name is the Database name you want to connect and node_name is the name defined in the above step ( Catalog the Node )

[db2inst1@mercury ~]$ $ db2 catalog database EMPDB at node PRODDB

=============================================================

Disconnect directory

====================================================================

After cataloging, do a db2 terminate to ensure everything shows up

1) Login to the local machine from where you want to connect to remote DB2 Database as the previliged user who would be connecting and owner of the db2client installation
2) Execute the below command

db2 terminate

[db2inst1@mercury ~]$db2 terminate

=============================================================

Testing the Catalog

====================================================================

After cataloging the DB2 instance always check the connectivity

1) Login to the local machine from where you want to connect to remote DB2 Database as the previliged user who would be connecting and owner of the db2client installation
2) Execute the below command

db2 connect to <database_name> user <user_name> using <password>

Where database_name is the Database name you want to connect and user_name is the name defined in the DB Instance owner with its password

[db2inst1@mercury ~]$ db2 connect to EMPDB user db2inst1 using pa@1fasdf

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>