Cataloging Db2 databases after changing the Db2 server

If you change the Db2 database names, Db2 server node, or Db2 port number, you must update the catalogs.

About this task

When you catalog a database, you can set the authentication to either server or server_encrypt depending on the authentication configuration on the Db2 server. For more information, see Changing Db2 authentication from server to server_encrypt. The following example shows how to set authentication to server_encrypt for the APMG Db2 server node while you are cataloging the DMARTG database.
db2 catalog database DMARTG as DATAMART at node APMG authentication server encrypt
Note: If you are changing the Db2 server node or Db2 port number only when you are moving the Db2 databases from one Db2 server to another Db2 server, then you need to recatalog the Db2 server node only. Issue the following commands:
  1. To uncatalog the node. Issue the following command:
    db2 uncatalog node Db2_server_node

    where Db2_server_node is the existing Db2 server node.

  2. Catalog the new Db2 server. Issue the following command:
    db2 catalog tcpip node current_Db2_server_node remote new_Db2_server server new_db2port
    where:
    • current_Db2_ server_node is the current Db2 server node.
    • new_Db2_server is the new Db2 server host name or IP address.
    • db2port is the new Db2 port number.
    You can optionally set the authentication type when you are issuing the db2 catalog command. You should uncatalog and recatalog the APM_NODE that was created by the initial Cloud APM server installation and uncatalog and recatalog any additional nodes that you created.

    For more information about the db2 catalog tcpip node commands, see CATALOG TCPIP/TCPIP4/TCPIP6 NODE command. For more information about the db2 catalog db command, see CATALOG DATABASE command.

Procedure

Complete the following steps to catalog the databases, Db2 server nodes and Db2 port number:

Note: This is an example procedure. The catalog commands that you use when you are completing your cataloging will be the same but the database names, Db2 server node, Db2 server host name, port number, and itmuser password will be different.

  1. On the Cloud APM server, issue su to the Db2 instance user ID. For example, for the db2apm instance user ID, issue the following command:
    su - db2apm
  2. Run the following catalog commands to catalog the databases, Db2 server node, and Db2 port number.
    1. Save a copy of your current catalog information. For example:
      
      db2 list db directory  >> /tmp/db.directory
      db2 list node directory >> /tmp/node.directory
      
    2. Uncatalog the existing Db2 server node. Issue the following command:
      db2 uncatalog node Db2_server_node
    3. Catalog to the new Db2 server node. Issue the following command:
      db2 CATALOG TCPIP NODE new_node REMOTE db2server SERVER db2port

      where new_node is APMG, db2server is db21056.rtp.raleigh.ibm.com, and db2port is 50005.

    4. Uncatalog the default original databases. Issue the following commands:
      
      db2 uncatalog db WAREHOUS
      db2 uncatalog db DATAMART
      db2 uncatalog db SCR32
      
    5. Catalog your new databases as the new default database names. Issue the following commands.
      
      db2 catalog db new_warehous at node new_node
      db2 catalog db new_datamart at node new_node
      db2 catalog db new_scr32 at node new_node

      where new_warehous is WHOUSG, new_datamart is DMARTG, new_scr32 is SCRG, and new_node is APMG. Never use APM_NODE as the node name because the Cloud APM server uses the APM_NODE node name.

      The following type of output is displayed when the catalog commands are successful.
      DB2XXXX  The CATALOG X command completed successfully.
    6. Catalog the default alias names for the new databases. Issue the following commands.
      
      db2 catalog db new_warehous as WAREHOUS at node new_node
      db2 catalog db new_datamart as DATAMART at node new_datamart
      db2 catalog db new_scr32 as SCR32 at node new_node
      db2 terminate
      
    7. Test the connections to the new databases. Issue the following commands.
      
      db2 connect to new_warehous user itmuser using itmpw
      db2 connect to new_datamart user itmuser using itmpw
      db2 connect to new_scr32 user itmuser using itmpw
      db2 connect to WAREHOUS user itmuser using itmpw
      db2 connect to DATAMART user itmuser using itmpw
      db2 connect to SCR32 user itmuser using itmpw
      db2 terminate  
      
      Based on the variables, itmpw in the previous commands is xxxyyy. Output similar to the following is displayed if the connections are successful. This output is for the new DMARTG database.
      
      $ db2 connect to new_datamart user itmuser using itmpw
      Database Connection Information
      
      Database server        = DB2/LINUXX8664 10.5.6
      SQL authorization ID   = ITMUSER
      Local database alias   = DMARTG
      

Results

The new databases, the Db2 server node, and port number are cataloged.

What to do next

Updating the Cloud APM server configuration for Db2 server changes