shift_1 发表于 2010-10-27 09:12

DB2数据库服务器主机名如何修改

产品:DB2 UDB

平台:AIX,Solaris,HP-UX,Linux,Windows

版本:V8 V9.1V9.5

问题描述:

出于各种各样的原因,在DB2服务器使用过程中,用户有可能需要修改DB2数据库服务器的主机名,那么DB2需要做哪些相应的修改呢?

问题解答:

为了修改DB2服务器的主机名,我们可以在DB2数据库服务器上执行以下步骤来实现:

1) 停止DB2管理服务器(DAS)?/SPAN>DB2实例

a)db2admin stop

在Windows上,您可以直接执行命令来停止DAS,在Linux和UNIX上,您可以执行命令来获取DAS实例的名称,然后再停止DAS,如

db2set -all |grep DB2ADMINSERVER

DB2ADMINSERVER=das91

然后su – das91后执行命令“db2admin stop”

b) db2stop

如果有多个实例,需要全部停止。可以用db2ilist命令列出该主机上所有的实例,然后一一停止

如果是Windows系统,您可以

set DB2INSTANCE=INST1

db2stop

这样来停止实例

如果是Linux或UNIX系统,您可以分别登录实例用户来执行”db2stop”

2)修改服务器主机名(各种操作系统如何修改主机名,请参阅相关操作系统文档)

3)以DB2实例用户登录后,执行

db2set -g DB2SYSTEM=<new hostname>

db2 terminate

上述命令,在Windows上,应该不会遇到问题,但是如果您的操作系统是Linux或者是UNIX的话,有可能此时遇到错误,如:

如果是V8、V9.1,您将遇到如下错误信息:

$ db2set –g DB2SYSTEM=pirates

DB2SET processing complete, rc = -2029059830, SQLCODE = 0

如果是V9.5,您将遇到如下错误信息:

$ db2set -g DB2SYSTEM=privates

DBI1309E System error.

Explanation:

The tool encountered an operating system error.

User response:

A system error was encountered during registry access. Ensure that there

is enough space on the file system where the registry is located, and

that there is a valid LAN connection if the registry is remote.

上述错误的原因是因为全局变量的操作涉及到系统级别的文件,实例用户并无相应权限来修改文件,而是需要root权限。我们可以用以下方法来完成该命令的执行:

$ su root

root's Password:

$ db2set -g db2system=privates

$ db2 terminate

注意:上述su命令用不带- 的,使得root具有实例用户的环境变量

如果有多个实例,上述命令只需执行一次

用实例用户检查修改情况,可以确认已经修改完成。

$ db2set –all |grep DB2SYSTEM

shift_1 发表于 2010-10-27 09:14

DB2SYSTEM= privates

4)编辑db2nodes.cfg文件

该文件位于

** Linux和UNIX: <db2 instance home directory>/sqllib/db2nodes.cfg
** Windows: <db2 install directory>\IBM\SQLLIB\DB2\db2nodes.cfg
把主机名修改为新的主机名,如db2node.cfg原内容为

0 red01 0

改为新的主机名

0 privates 0

如果有多个实例,请一并修改

5) 更新DB2管理服务器的配置信息

a) db2 list admin node directory show detail
b) db2 uncatalog node <old_hostname>
c) db2 catalog admin tcpip node <new hostname> remote <new hostname> system <new hostname>
d) db2 update admin cfg using DB2SYSTEM <new hostname>
e) db2 update admin cfg using SMTP_SERVER <new hostname>

a)db2admin start

在Windows上,您可以直接执行命令来启动DAS,在Linux和UNIX上,您可以执行命令来获取DAS实例的名称,然后再停止DAS,如

db2set -all |grep DB2ADMINSERVER

DB2ADMINSERVER=das91

然后su – das91后执行命令“db2admin start”

b)db2start

如果有多个实例,需要全部运行。可以用db2ilist命令列出该主机上所有的实例,然后一一启动

如果是Windows系统,您可以

set DB2INSTANCE=INST1

db2start

这样来启动实例。

如果是Linux或UNIX系统,您可以分别登录实例用户来执行”db2start”

7) 从服务器上的DB2控制中心删除旧主机名的条目,然后单击“添加系统”菜单,用新主机名发现新的主机名来添加。如果您从来不使用控制中心等GUI工具,此步骤可以忽略。而且,从DB2 V9.1开始,在UNIX系统上将不再提供控制中心等GUI工具。

注意:

从DB2 V9.1 FP2开始,DB2支持用域用户组作为扩展Windows安全性。因此,当您要更改计算机名的时候,计算机用户组DB2ADMNS和DB2USERS是本地用户组,您必须更新全局注册表变量DB2_ADMINGROUP和DB2_USERSGROUP。当计算机主机名修改并且重启后,用以下步骤来修改注册表变量:

1. 打开一个命令行

2. 执行db2extsec命令来更新安全设置

db2extsec -a <new computer name>\DB2ADMNS -u <new computer name>\DB2USERS
页: [1]
查看完整版本: DB2数据库服务器主机名如何修改