Cataloging databases after reinstalling DB2

On Windows, uninstalling DB2 will remove the instance but keep the databases in place. After you reinstall, you’ll want to recatalog these databases. This is fairly straightforward.

Find out their names:

db2 list db directory on C:

Map each of the databases that you want:

db2 catalog db SAMPLE on C:

You can also catalog remote databases the same way. In my experience, this is much easier than going through Control Center:

db2 catalog tcpip node MYNODE remote MYHOSTNAME server 50000
db2 catalog db SAMPLE as MYSAMPLE at node MYNODE
db2 connect to MYSAMPLE user MYUSER using MYPASSWORD

The database will now show up in your Control Center catalog. You will also be able to connect to the local alias from Data Studio and other tools.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.