Changing the Hostname for a DB2 Server

Posted by Frank Fillmore on November 14, 2008 under DB2 for Linux Unix Windows. Tags: , , .

Sorry I haven’t posted in a little while.  October was a 250 hour month with a critical customer project and the IBM Information OnDemand Conference (IOD – you know all about IOD from Kim).  My VP of Biz Dev is all about trying to make her “number”, so it’s been busy.

The Fillmore Group is an IBM Authorized Training Partner (ATP) so we use a product called Acronis to create a single image of our student lab machines and then deploy that image to multiple PCs.  Since these are Windows XP PCs running DB2 9 for Linux, Unix, Windows Fixpack (FP) 2, the computer name must be unique within the domain.  However, once you change the computer name, DB2 stops working.  The common error is SQL1042C.  Here’s how to fix that problem.

First, there is a file in each DB2 instance subdirectory (e.g. “c:\Program Files\IBM\SQLLIB\DB2”) called db2nodes.cfg; in this post we’re only going to address single-node (i.e. not Data Partitioning Feature or DPF) databases.  Open this file for each DB2 instance on the server – I use WordPad – and change the imbedded hostname to the current computer name for that PC.  The same hostname will be repeated twice on a single line in the db2nodes.cfg file.  Change both.  This used to be all you needed to do to fix the problem.  Now, there are a few more steps.

If you installed using the extended operating system security option, you likely will now receive an SQL1652N file I/O error.  In DB2 9.1 FP 2, support was added for domain userids and groups.  Use the db2extsec command to correct the authorities for the installation-defined groups DB2ADMNS and DB2USERS.  For example, let’s say the PC image was created using a computer name of TFGXP01.  We’ve deployed this image to another PC and changed the Windows computer name to TFGXP02.  Enter the command:

db2extsec -a TFGXP02\DB2ADMNS -u TFGXP02\DB2USERS

The last step involves correcting the DB2 registry variables.  Use the db2set -all command to examine the current registry variables.  In our example, you likely will have seen three variables with TFGXP01 as part of the value.  Issue the following commands:

db2set db2accountname=TFGXP02\db2admin

db2set db2instowner=TFGXP02

db2set db2system=TFGXP02

At this point, you should be able to start the DB2 instances.

16 Comments so far

  1. Anonymous February 5, 2009 5:55 pm

    Very useful, thanks much.

  2. Adam April 15, 2009 2:18 pm

    Has this been updated for 9.5? I don’t see a db2nodes.cfg file to change, nor do I have a db2extsec executable, it seems…

  3. Kim May April 27, 2009 8:39 pm

    Adam – I am not sure they have been updated…I will check with Frank and ask him to post an update if needed. Time flies…

  4. Diana moreno April 29, 2009 6:39 am

    Hi, I need to change the hostname of my DB2 Server 9.5, I tried to run his procedure, but I’ve have problems:
    1. I don’t find the db2nodes.cfg file.
    2. I run the commands “db2set” and db2extsec,

    old_hostname: SIETE2003
    new_Hostname: VS3K-MONBANCO1
    ->cmd
    ->db2cmd
    ->db2admin stop
    ->db2stop
    ->db2set -g DB2SYSTEM=VS3K-MONBANCO1
    ->db2set -g DB2_EXTSECURITY=NO
    ->db2set –all

    ->db2 list admin node directory show detail
    ->db2 uncatalog node SIETE200
    ->db2 catalog admin tcpip node VS3KMONB remote VS3K-MONBANCO1 system VS3K-MONBANCO1
    ->db2 update admin cfg using DB2SYSTEM VS3K-MONBANCO1
    ->db2 update admin cfg using SMTP_SERVER VS3K-MONBANCO1

    –>change the hosstname

    ->cmd
    ->db2cmd
    ->db2admin stop
    ->db2extsec -a VS3K-MONBANCO1\DB2ADMNS -u VS3K-MONBANCO1\DB2USERS
    ->db2admin start
    ->db2start

    And when finish I have in “Control Center DB2” two systems, SIETE2003 with the Instance, and VS3K-MONBANCO1 without instances.

    How do you can to my current instances work on new system VS3K-MONBANCO1?

    Thanks for your help.

  5. Iliko Sama May 19, 2009 5:47 am

    I have the same problem as Diana. In local control center (im on windows machine) i can see two systems now: the old and new one. However the old system doesnt exists anymore if you do the node list. Nor you can find it VIA remote database administration tool, everything discovers and adds fine with that new name. Databases work fine for my applications as well.

    I just can’t run any commands for my databases on that local machine because both CLP and the Control Center thinks all instances are still belong to that old system and hostname 😐

    Don’t you know what this could be? Thank you very much in advance.

  6. Carl Lutz June 22, 2009 8:40 am

    I am having a similar problem. There does not appear to be a db2nodes.cfg file on the db2 server anywhere.
    I used acronis to grab an image of our live server and put it on an identical machine(with less memory). When disconnected from our domain, due to the duplicate computer name, There are some expected authentication issues since the DC cannot be contacted. If I change the server’s name and reconnect to our network, I receive the SQL1042C error you mentioned.

  7. Daniel Persson December 3, 2009 3:17 am

    Just for those who find this site first:

    Windows XP and 2003 running DB2 v9.5:
    Documents and Settings\All Users\Application Data\IBM\DB2\\DB2\db2nodes.cfg

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

  8. charl December 9, 2009 12:35 am

    I am facing “SQL1652N File I/O error occurred” when doing DB2START. This problem occured after server crash. Any help would be appreciated.. Thanks

  9. Ben December 30, 2009 6:03 pm

    Brilliant. This saved me big time, as I had tried a million other things without success. Thanks so much for posting this!!!!

  10. JC July 9, 2010 1:34 pm

    Hello,
    I can neither find the db2nodes.cfg nor do any of the commands posted by Diana Moreno work on my WinXP, DB29.5 env. When I enter any of the db2set commands in the commandline, I just get an error dialog saying it will close.

    Any suggestions?

  11. Rudy July 19, 2010 1:11 pm

    Confirmed all steps with DB2 v9.7 FP1 and FP2 (x64) on Windows 2008 SP1 (x64).

  12. PDiddy December 14, 2010 5:18 pm

    The reason you can’t find db2nodes.cfg on a windows server is that it doesn’t have any file associations for .cfg files. Use the findstr command to find files with the old hostname in it: findstr /i /m /s “” :\*.*

  13. kapil mehta November 12, 2011 7:49 pm

    I have installed DB2-9 suucessfully.
    Can you tell me how to start DB@ through cmd.

  14. Brett February 7, 2012 10:53 pm

    DB2 V9.7 FP5
    Windows 7 Professional

    1. My db2nodes.cfg was in a different location:

    C:\ProgramData\IBM\DB2\DB2COPY1\DB2\db2nodes.cfg

    I made the recommended edits there.

    2. I only had two variables that had the old hostname / machine-name in there:

    db2set db2instowner=
    db2set db2system=

    After those minor differences, DB2 started correctly, and no longer gets the SQL1042C error, and works correctly. Thanks!

  15. Matt Geiger April 4, 2013 10:26 am

    I couldn’t find db2nodes.cfg on Windows 7 Enterprise. On further searching found:
    C:\ProgramData\IBM\DB2\DB2COPY1\DB2\db2nodes.cfg

  16. Joe Hayes January 9, 2019 3:26 pm

    This is excellent. Thanks for the guidance!

Trackbacks

Leave a Comment

Name

Email

Website

Comments

More