DB2 catalog

2013/03/27 17:32
阅读数 52

DB2′s Got Talent!

This is it, the final vote! You determine whether I get 1st, 2nd, 3rd, or 4th place. Go to: http://www.dbisoftware.com/blog/db2nightshow.php?id=429, scroll to the bottom, and fill out the “Show Survey”. Vote for me (EMBER), and also please rank me as #1. Sign up to watch the results show where they announce the winners here: http://www.dbisoftware.com/db2nightshow/

How to catalog a DB2 database

by Ember Crooks onApril 14, 2011

So I’m doing a lot of posts in the DB2 Basics area this week. That’s because they are quick for me to write, and they’re questions I get all the time. So bear with me if you read for the more detailed Commerce topics – I’m not abandoning them.

DB2 Client

DB2 databases can be cataloged on DB2 servers or DB2 clients. Before trying cataloging, make sure you at least have the DB2 client installed. DB2 Clients are free (no licensing required). All App servers should have DB2 clients already installed on them. Web servers should not. You can download DB2 Clients here: https://www-304.ibm.com/support/docview.wss?uid=swg27007053

Select the same version and FixPack as the servers you’re connecting to. Then select the proper OS. Finally, select “IBM Data Server Client” (9. versions) or “Administration Client” (8. versions). Installation and Instance creation are outside the scope of this post.

Make sure you have all the inputs

You need:

  • REMOTE: Short host name with proper entry in hosts file OR Fully qualified host name OR IP address (that is the order of preference if you have all)
  • SERVER: Port number the db2 server is listening on. To get this, log into db2 server as the db2instance owner (frequently db2inst1), and do:
$ db2 get dbm cfg |grep SVCENAME
TCP/IP Service name                          (SVCENAME) = db2c_db2inst1
$ cat /etc/services |grep db2c_db2inst1
db2c_db2inst1   50001/tcp
  • NODENAME: This is a name that you make up.  You might want to develop a standard for your company and stick to it.

Catalog the node

The general form of the syntax for doing this is:

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

For example:

Logged in (su – is fine) as the db2 instance owner or a privileged user:

$ db2 catalog tcpip node prod_ecom remote servername.domain.com server 50001

Catalog the database

The general form of the syntax for doing this is:

db2 catalog database <database_name> at node <node_name>

For example:

Logged in (su – is fine) as the db2 instance owner or a privileged user:

db2 catalog database wcs_prod at node prod_ecom

Refresh directory

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

$ db2 terminate
DB20000I  The TERMINATE command completed successfully.

Always test a connection!!

It is very important to test the connection because a typo could cause it not to work. Or there could be network issues preventing connection.
The general form of the syntax for doing this is:

db2 connect to <database_name> user <user_name> (you will then be prompted for a password)

For example:

Logged in (su – is fine) as the db2 instance owner or a privileged user:

db2 connect to wcs_prod user ecrooks
Enter current password for ecrooks:

Database Connection Information

Database server        = DB2/LINUX 8.2.9 
SQL authorization ID   = ECROOKS 
Local database alias   = WCS_PROD
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部