Topic
  • 6 replies
  • Latest Post - ‏2016-01-22T19:58:06Z by TomKennedy
amccarl
amccarl
73 Posts

Pinned topic What updates in DB2 need to be made to change the hostname of the DB2 server?

‏2013-06-11T18:45:43Z | db2 dbdsupport hivalue technical-article

In order to change the DB2 server's hostname, 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
    db2iset -g DB2SYSTEM=<new hostname>
  • Windows 
    db2set -g DB2SYSTEM=<new hostname>

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 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

    NOTE: Application Data is a hidden folder
     
  • Windows Vista 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. 

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 

    If 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 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

 

This is also covered by the technical article 1258834, http http://www.ibm.com/support/docview.wss?uid=swg21258834
 
  • amccarl
    amccarl
    73 Posts

    Re: What updates in DB2 need to be made to change the hostname of the DB2 server?

    ‏2013-06-14T14:26:24Z  
    Hello!  We've had a number of clients respond through feedback to our technical documents indicating that they have further questions or comments that require additional dialogue.  Unfortunately, our feedback is anonymous, so unless an email address or other contact information is included, we have no way to get back in touch with you.
     
    Within DB2 support, the management team asked if we could somehow link our documents to the forums so that we could invite more discussion - like this!   As a start, we chose about 30 technical articles and "seeded" the forum with initial entries so that we could have a starting place for conversation.  The documents have now been updated with links to the forums as well.  
     
    Hopefully, we will make DB2 support better by providing more interaction around our technical information!
     
  • The david
    The david
    1 Post

    Re: What updates in DB2 need to be made to change the hostname of the DB2 server?

    ‏2015-05-21T16:04:30Z  
    • amccarl
    • ‏2013-06-14T14:26:24Z
    Hello!  We've had a number of clients respond through feedback to our technical documents indicating that they have further questions or comments that require additional dialogue.  Unfortunately, our feedback is anonymous, so unless an email address or other contact information is included, we have no way to get back in touch with you.
     
    Within DB2 support, the management team asked if we could somehow link our documents to the forums so that we could invite more discussion - like this!   As a start, we chose about 30 technical articles and "seeded" the forum with initial entries so that we could have a starting place for conversation.  The documents have now been updated with links to the forums as well.  
     
    Hopefully, we will make DB2 support better by providing more interaction around our technical information!
     

    Andrew,

    Are these steps working on 10.5? If not, are there any additional steps to be done? Or, this is only supported on 9.x. Thanks.

    David (yu_yuan@excite.com)

  • ITNinja
    ITNinja
    1 Post

    Re: What updates in DB2 need to be made to change the hostname of the DB2 server?

    ‏2015-09-16T18:02:15Z  

    Hello

    I work for a software development company and they use DB2 in a lot of their server Virtual Machines. I just want to share my experience and solution because I spent many hours of frustration on this and nobody's online help would work.

    We typically only use the "Express" versions of DB2 and these virtual machines were running Windows Server 2008 Standard. Long story short, we had the need to clone a VM and then change the Hostname. After the hostname change, we got all sorts of errors that were related to the licensing. Of coarse this was wrong and caused a couple hours worth of frustration. I fixed the issue by editing 6 registry keys that I will share later. the Express versions did not have db2nodes.cfg (which also caused a good hour worth of frustration).

    I followed many instruction on how to get the hostname changed, and nothing worked for me. I had to go into the registry and find these keys and changing them worked for me. after that, DB2 fired up no problem. thankfully these were virtual machines and not production critical and I could afford to "break stuff" if trying the registry edit in a production environment, just make sure to backup the registry first.

     

    Here is the PowerShell Script I created and they list the path of the registry keys that I had to edit

     

    # Set-ItemProperty is the cmdlet that you use to edit a registry key
    # -Path is where you specify the path to the key you want to change (if using regedit, the path is shown in the bottom left corner)
    # HKEYs are abbrivated to HKCR, HKCU, HKLM, HKU, HKCC
    # -Name is where you specify the name of the key you want to change
    # -Value is where you specify the new value you want the key to have

    # DB2 is the configuration of the DEFAULT installtion process
    # DB2COPY1 is the DEFAULT database engine that is created
    # When registering a new hostname you must change 6 keys, 3 for the install configuration, 3 for the database engine itself.
    ## For each of those 3, 1 key registers DB2SYSTEM to the hostname, the other 2 registers the "DB2_ADMINGROUP" and "DB2_USERGROUP" to the hostname

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\GLOBAL_PROFILE -Name DB2SYSTEM -Value <new hostname>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\GLOBAL_PROFILE -Name DB2_ADMINGROUP -Value <new hostname>\<local DB2 admin username>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\GLOBAL_PROFILE -Name DB2_USERSGROUP -Value <new hostname>\<local DB2 user username>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\InstalledCopies\DB2COPY1\GLOBAL_PROFILE -Name DB2SYSTEM -Value <new hostname>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\InstalledCopies\DB2COPY1\GLOBAL_PROFILE -Name DB2SYSTEM -Value <new hostname>\<local DB2 admin username>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\InstalledCopies\DB2COPY1\GLOBAL_PROFILE -Name DB2SYSTEM -Value <new hostname>\<local DB2 admin username>

     

    I hope this helps other users who have a similar issue

     

  • andrewmcl
    andrewmcl
    119 Posts

    Re: What updates in DB2 need to be made to change the hostname of the DB2 server?

    ‏2015-09-16T21:50:11Z  

    Another good reason to NOT use Windows

  • Jun Su Lee
    Jun Su Lee
    32 Posts

    Re: What updates in DB2 need to be made to change the hostname of the DB2 server?

    ‏2015-09-17T08:26:47Z  

     

    Thanks for good article.

     

    Just adding one more case of HADR/TSA environment.

    Following technote describes the necessary steps if we need to change hostname in HADR/TSA environment.

    http://www-01.ibm.com/support/docview.wss?uid=swg21673628

     

     

     

     

     

  • TomKennedy
    TomKennedy
    1 Post

    Re: What updates in DB2 need to be made to change the hostname of the DB2 server?

    ‏2016-01-22T19:58:06Z  
    • ITNinja
    • ‏2015-09-16T18:02:15Z

    Hello

    I work for a software development company and they use DB2 in a lot of their server Virtual Machines. I just want to share my experience and solution because I spent many hours of frustration on this and nobody's online help would work.

    We typically only use the "Express" versions of DB2 and these virtual machines were running Windows Server 2008 Standard. Long story short, we had the need to clone a VM and then change the Hostname. After the hostname change, we got all sorts of errors that were related to the licensing. Of coarse this was wrong and caused a couple hours worth of frustration. I fixed the issue by editing 6 registry keys that I will share later. the Express versions did not have db2nodes.cfg (which also caused a good hour worth of frustration).

    I followed many instruction on how to get the hostname changed, and nothing worked for me. I had to go into the registry and find these keys and changing them worked for me. after that, DB2 fired up no problem. thankfully these were virtual machines and not production critical and I could afford to "break stuff" if trying the registry edit in a production environment, just make sure to backup the registry first.

     

    Here is the PowerShell Script I created and they list the path of the registry keys that I had to edit

     

    # Set-ItemProperty is the cmdlet that you use to edit a registry key
    # -Path is where you specify the path to the key you want to change (if using regedit, the path is shown in the bottom left corner)
    # HKEYs are abbrivated to HKCR, HKCU, HKLM, HKU, HKCC
    # -Name is where you specify the name of the key you want to change
    # -Value is where you specify the new value you want the key to have

    # DB2 is the configuration of the DEFAULT installtion process
    # DB2COPY1 is the DEFAULT database engine that is created
    # When registering a new hostname you must change 6 keys, 3 for the install configuration, 3 for the database engine itself.
    ## For each of those 3, 1 key registers DB2SYSTEM to the hostname, the other 2 registers the "DB2_ADMINGROUP" and "DB2_USERGROUP" to the hostname

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\GLOBAL_PROFILE -Name DB2SYSTEM -Value <new hostname>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\GLOBAL_PROFILE -Name DB2_ADMINGROUP -Value <new hostname>\<local DB2 admin username>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\GLOBAL_PROFILE -Name DB2_USERSGROUP -Value <new hostname>\<local DB2 user username>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\InstalledCopies\DB2COPY1\GLOBAL_PROFILE -Name DB2SYSTEM -Value <new hostname>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\InstalledCopies\DB2COPY1\GLOBAL_PROFILE -Name DB2SYSTEM -Value <new hostname>\<local DB2 admin username>

    Set-ItemProperty -Path HKLM:\Software\IBM\DB2\InstalledCopies\DB2COPY1\GLOBAL_PROFILE -Name DB2SYSTEM -Value <new hostname>\<local DB2 admin username>

     

    I hope this helps other users who have a similar issue

     

    Thank you.  I struggled for 2 days on this.  DB2 team should add script for this. 

    I had multiple copies as well.

     

    Changing host name is not  that uncommon.