This article mainly describes how to correctly modify the Host Name of the DB2 server. In practice, for various reasons, during actual use of the DB2 database server, the user may modify the Host Name of the DB2 database server. This article describes in detail how to modify the Host Name of DB2.
Environment:
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
The above command should not cause any problems on Windows, but if your operating system is Linux or UNIX, you may encounter errors at this time, such:
If it is 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
This file is located in
- ** Linux and UNIX:/sqllib/db2nodes. cfg
- [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 DB2 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, but if your operating system is Linux or UNIX, you may encounter errors at this time, such:
If it is 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
This file is located in
- ** Linux and UNIX:/sqllib/db2nodes. cfg
The above content describes how to modify the Host Name of the DB2 server, hoping to help you in this regard.