千家信息网

db2 创建实例 The host name "fordatabase" is invalid. Specify a valid host name.

发表于:2024-11-14 作者:千家信息网编辑
千家信息网最后更新 2024年11月14日,有这样一个现象,在DB2安装后,使用db2icrt 来创建实例时,提示主机名无效,提示如下:[plain] view plain copy[root@centos-0 instance]# ./db2
千家信息网最后更新 2024年11月14日db2 创建实例 The host name "fordatabase" is invalid. Specify a valid host name.

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



[plain] view plain copy

  1. [root@centos-0 instance]# ./db2icrt -u db2inst1 db2inst1

  2. The host name "centos-0.msdomain" is invalid. Specify a valid host name.

  3. DBI1922N The host name is not valid.

  4. Explanation:

  5. The TCP/IP host name parameter is not valid or does not exist.

  6. User response:

  7. Ensure that TCP/IP is operational on the system. If a domain name server

  8. is used, ensure that the domain name server machine is active. Issue the

  9. command again using the correct TCP/IP host name.

  10. DBI1079I Output is saved in the log file /tmp/db2icrt.log.2816.

  11. Explanation:

  12. All processed and failed operations have been saved into this log file.

  13. User response:

  14. Do not modify this file in any way. This file is for IBM Technical

  15. Support reference.

  16. /opt/ibm/db2/V9.7/instance/db2iutil: line 2528: DB2INSTVER: parameter null or not set



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


[plain] view plain copy

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

  2. if [ $? -eq 3 ]; then

  3. db2isrv

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

  5. if [ $? -eq 3 ]; then

  6. display_msg ${DB2CAT?} 922 \

  7. 'DBI1922N The host name is not valid.\n'

     stop_prog 1
    fi


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

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

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

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

  12. 好的,看一下主机名定义

  13. [root@centos-0 instance]# hostname

  14. centos-0.msdomain这没问题

  15. 再看

  16. [root@centos-0 instance]# vi /etc/hosts

  17. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

  18. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

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

  20. [root@centos-0 instance]# vi /etc/hosts

  21. 127.0.0.1 localhost centos.msdomain localhost4 localhost4.localdomain4

  22. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

  23. 保存再次执行创建实例,正常



0