有这样一个现象,在DB2安装后,使用db2icrt 来创建实例时,提示主机名无效,提示如下:



[plain]view plaincopy

[root@centos-0instance]#./db2icrt-udb2inst1db2inst1

Thehostname"centos-0.msdomain"isinvalid.Specifyavalidhostname.

DBI1922NThehostnameisnotvalid.

Explanation:

TheTCP/IPhostnameparameterisnotvalidordoesnotexist.

Userresponse:

EnsurethatTCP/IPisoperationalonthesystem.Ifadomainnameserver

isused,ensurethatthedomainnameservermachineisactive.Issuethe

commandagainusingthecorrectTCP/IPhostname.

DBI1079IOutputissavedinthelogfile/tmp/db2icrt.log.2816.

Explanation:

Allprocessedandfailedoperationshavebeensavedintothislogfile.

Userresponse:

Donotmodifythisfileinanyway.ThisfileisforIBMTechnical

Supportreference.

/opt/ibm/db2/V9.7/instance/db2iutil:line2528:DB2INSTVER:parameternullornotset



检查 /opt/ibm/db2/V9.7/instance/db2iutil 文件(非提示的2528行),发现有如下内容


[plain]view plaincopy

${DB2DIR?}/instance/db2isrv-addfcm-i${INSTNAME?}${DB2ISRVOPTS?}

if[$?-eq3];then

db2isrv

${DB2DIR?}/instance/db2isrv-addfcm-i${INSTNAME?}${DB2ISRVOPTS?}

if[$?-eq3];then

display_msg${DB2CAT?}922\

'DBI1922NThehostnameisnotvalid.\n'<prename="code"class="plain">stop_prog1</pre>fi<p></p>

<pre></pre>

<br>

就是当db2isrv-addcfm-i${INSTNAME?}${DB2ISRVOPTS?}返回为3的时候提示主机名称不正确。<br>

这个db2isrv找了很多东西,没找到具体的内容,看名字是给系统增加一个服务。后面是addfmc,这个fmc是DB2的故障守护进程。<br>

这个是监测DB2实例正常运行,当实例异常宕机后,它会自动启动实例。那么以上的错误可以连起来了:<br>

再给系统增加一个DB2守护进程的时候失败了,原因是主机名不对。<br>

好的,看一下主机名定义<br>

<p></p>

<p></p><prename="code"class="plain">[root@centos-0instance]#hostname

centos-0.msdomain</pre>这没问题<br>

再看<p></p>

<p></p><prename="code"class="plain">[root@centos-0instance]#vi/etc/hosts

127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4

::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6</pre><br>

这个地方不知为什么CENTOS装好之后没有修改,修改一下。修改后内容如下<br>

<p></p>

<p></p><prename="code"class="plain">[root@centos-0instance]#vi/etc/hosts

127.0.0.1localhostcentos.msdomainlocalhost4localhost4.localdomain4

::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6</pre><br>

保存再次执行创建实例,正常<p></p>

<p><br>

</p>