IBM Support

Changing hostname of the DB2 server

Question & Answer


Question

Changing hostname of the DB2 server. What updates in DB2 need to be made?

Cause

Changing the DB2 server's hostname.

Answer

Perform the following on the DB2 server:

1) Login as the dasadm user on UNIX/Linux or Local Administrator on Windows. Stop the DB2 Administration Server (DAS):
  • db2admin stop

2) Login as the instance owner on UNIX/Linux or Local Administrator on Windows. Stop the DB2 instance:
  • db2stop

3) Change the server's hostname. On a Windows system, a reboot is required before this change will take effect. Do not reboot the Windows Server at this time - you must make the DB2 Configuration changes first.

4) Login as user ROOT if DB2 is on UNIX/Linux and Local Administrator on Windows. Update the DB2SYSTEM registry variable while in the instance home directory:
  • UNIX/Linux
db2set -g DB2SYSTEM=<new hostname>
  • Windows
    db2set -g DB2SYSTEM=<new hostname>
Note (Windows): If db2set fails because the hostname was already changed before implementing this technote, search the Windows registry keys containing values for the old hostname and change to new hostname by searching trees below:
  [HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\GLOBAL_PROFILE\SOFTWARE\IBM\DB2\GLOBAL_PROFILE]   [HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\GLOBAL_PROFILE\SOFTWARE\IBM\DB2\INSTALLEDCOPIES\DB2COPY1\GLOBAL_PROFILE]   [HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\GLOBAL_PROFILE\SOFTWARE\IBM\DB2\INSTALLEDCOPIES]   [HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\GLOBAL_PROFILE\SOFTWARE\IBM\DB2\INSTALLEDCOPIES\DB2COPY1\PROFILES]    

5) Locate db2nodes.cfg in one of the following directories:
  • UNIX/Linux:
    <db2 instance home directory>/sqllib/db2nodes.cfg
     
  • All Windows flavors running DB2 v8.x and v9.1:
    Program Files\IBM\SQLLIB\DB2\db2nodes.cfg
     
  • Windows XP and 2003 running DB2 v9.5:
    Documents and Settings\All Users\Application Data\IBM\DB2\<DB2COPY>\DB2\db2nodes.cfg
  • Windows Vista,7,10 and later operating systems: ProgramData\IBM\DB2\<DB2COPY>\DB2\db2nodes.cfg
Note that only DB2 ESE has a db2nodes.cfg. If you are running other editions (WorkGroup Server, or Personal Edition) then you can skip this step and the next.
NOTE: Application Data and ProgramData are hidden folders

6) In the db2nodes.cfg file change <current hostname> to <new hostname>.

7) Run the following command to list the current hostname/system name that is cataloged:
  • db2 list admin node directory show detail
Admin nodes are used for legacy DB2 Administration Server (DAS) so DB2 can be remotely administered using GUI tool like Control Center, Task Center, etc... These GUI tools were discontinued as of v10.1. Thus most modern installs of v10.5 and v11.1 can skip steps 7,8, 9, 14 and 15.
If DAS is still required and there are no Admin Node Directory entries then you can skip the next 2 steps. It simply means that you haven't started the Control Center. The Admin Node Directory will get updated the next time the Control Center is started, based upon the current hostname.
8) Uncatalog the current hostname using this command:
  • db2 uncatalog node <nodename>
9) Catalog the admin node with the new hostname using this command:
  • db2 catalog admin tcpip node <nodename> remote <new hostname> system <new hostname>

    <nodename> can be anything you want it to be (8 characters or less). It does not relate directly to the hostname itself.
10) Update the admin configuration file using these commands:
  • db2 update admin cfg using DB2SYSTEM <new hostname>
    db2 update admin cfg using SMTP_SERVER <new hostname>

11) At this time, you should restart your server if running Windows. Note that if your instances are set to auto-start, you may get error messages. These will occur if you have DB2_EXTSECURITY enabled (To check if its enabled, run the following command: db2set -all, look for DB2_EXTSECURITY=YES). To correct this, you will need to update the DB2_ADMINGROUP and DB2_USERSGROUP registry entries using the db2extsec command. See the 'note' at the end of this technote for more details.

12) Login as the dasadm user on UNIX/Linux or Local Administrator on Windows. Start the DB2 Administration Server (DAS):
  • db2admin start

13) Login as the instance owner on UNIX/Linux or Local Administrator on Windows. Start the DB2 instance:
  • db2start

14) In Control Center find the old hostname under the "All Systems" folder and right click, choose Remove.

15) In Control Center add the new hostname. Right click on the "All Systems" folder and choose "Add". Click on "Discover" to locate the new hostname.

NOTE:
Starting in v9.1 FP2, DB2 supports the use of domain groups for extended security. Therefore, when you change the computer name and the computer groups DB2ADMNS and DB2USERS are local computer groups, you must update the DB2_ADMINGROUP and DB2_USERSGROUP global registries. Please see the Related URL for instructions on how to do this.

If Windows Extended Security has been enabled then you will need to tell DB2 to lookup the Windows local groups DB2ADMNS and DB2USERS via the new hostname. For example if the hostname is changed to QASERVER then execute:

db2extsec /a QASERVER\DB2ADMNS /u QASERVER\DB2USERS

 

For further discussion on this topic, visit this developerWorks forum thread:
https://www.ibm.com/developerworks/community/forums/html/topic?id=2b3770ad-9a4f-4fb8-8bc0-0806c445f760

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Database Objects\/Config - Instance(DAS)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.7;9.5;10.1;10.5;11.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
24 April 2019

UID

swg21258834