In the management of DB2, you may need to modify the Host Name of the DB2 database server. I will instruct you to modify the Host Name of the DB2 server.
Product: DB2 UDB
Platform: AIX, Solaris, HP-UX, Linux, Windows
Version: V8 V9.1V9.5
To modify the server host name, perform the following steps on the DB2 database server:
1) Stop the DB2 Management Server (DAS) and DB2 instances
A) db2admin stop
On Windows, you can directly run the command to stop the DAS. on Linux and UNIX, you can run the command to get the name of the DAS instance, and then stop the DAS, such
- db2set-all|grepDB2ADMINSERVER
- [g]DB2ADMINSERVER=das91
Run the "db2admin stop" command after su-das91"
B) db2stop
If you have multiple instances, you must stop them all. You can use the db2ilist command to list all instances on the host and then stop them one by one.
For Windows, you can
- setDB2INSTANCE=INST1
- db2stop
In this way, stop the instance.
For Linux or UNIX systems, you can log on to the instance user to execute "db2stop"
2) modify the server host name (for details about how to modify the host name in various operating systems, refer to the relevant operating system documentation)
3) Run
- db2set-gDB2SYSTEM=db2terminate
The above command should not cause any problems on Windows. However, if your operating system is Linux or UNIX, errors may occur at this time, for example, V8 or V9.1,
You will encounter the following error message:
- $db2set–gDB2SYSTEM=pirates
- DB2SETprocessingcomplete,rc=-2029059830,SQLCODE=0
For V9.5, you will encounter the following error:
- $db2set-gDB2SYSTEM=privates
- DBI1309ESystemerror.
- Explanation:
- Thetoolencounteredanoperatingsystemerror.
- Userresponse:
- Asystemerrorwasencounteredduringregistryaccess.Ensurethatthere
- isenoughspaceonthefilesystemwheretheregistryislocated,and
- thatthereisavalidLANconnectioniftheregistryisremote.
The reason for the above error is that the global variable operation involves system-level files. The instance user does not have the corresponding permission to modify the file, but needs the root permission. We can execute this command using the following methods:
- $suroot
- root'sPassword:
- $db2set-gdb2system=privates
- $db2terminate
Note: The preceding su command does not contain-, so that the root user has the environment variable of the Instance user.
If there are multiple instances, the above command only needs to be executed once
Use the instance user to check the modification. You can confirm that the modification has been completed.
- $db2set–all|grepDB2SYSTEM
- [g]DB2SYSTEM=privates
4) edit the db2nodes. cfg file, which is located in
- ** Linux and UNIX:/sqllib/db2nodes. cfg
- ** Windows: IBMSQLLIBDB2db2nodes. cfg
Change the host name to a new host name. For example, the original content of db2node. cfg is 0 red01 0.
Change to new host name 0 privates 0
If you have multiple instances, modify them together.
5) Update the configuration information of the DB2 Management Server
- a)db2listadminnodedirectoryshowdetail
- b)db2uncatalognode
- c)db2catalogadmintcpipnoderemotesystem
- d)db2updateadmincfgusingDB2SYSTEM
- e)db2updateadmincfgusingSMTP_SERVER
6) Start the DB2 Management Server (DAS) and DB2 instances
A) db2admin start
On Windows, you can run the command to start the DAS. on Linux and UNIX, you can run the command to get the name of the DAS instance, and then stop the DAS, such
- db2set-all|grepDB2ADMINSERVER
- [g]DB2ADMINSERVER=das91
Run the "db2admin start" command after su-das91"
B) db2start
If you have multiple instances, you need to run them all. You can use the db2ilist command to list all instances on the host and start them one by one.
For Windows, you can
- setDB2INSTANCE=INST1
- db2start
In this way, start the instance.
For Linux or UNIX systems, you can log on to the instance user to run the "db2start" command"
7) Delete the old host name entry from the DB2 control center on the server, and click the "add system" menu to add a new host name. Skip this step if you never use GUI tools such as the control center. In addition, since DB2 V9.1, GUI tools such as control centers are no longer provided on UNIX systems.
- Install DB2 Express-C on Windows (1)
- IBM releases three features of DB2 9.7 guidelines for future applications
- Improve DB2 data backup and recovery efficiency
- DBase: Common commands and skills DB2 must understand
- XML data management practices using DB2 pureXML