1.查看svcename

[db2inst1@db01 ~]$ db2 get dbm cfg | grep -i svcename
TCP/IP Service name (SVCENAME) = DB2_db2inst1
SSL service name (SSL_SVCENAME) =

2.如果没有svcename需要设置,最后面的SVCENAME可以自定义​

db2 update dbm cfg using svcename DB2_db2inst1

3.在/etc/service里面添加对应的通讯端口

[root@db01 sqllib]# cat /etc/services | grep DB2_db2inst1
DB2_db2inst1 50000/tcp

4.查看是否有TCP/IP

[db2inst1@db01 ~]$ db2set -all
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=db01
[g] DB2INSTDEF=db2inst1

5.如果没有TCPIP,需要设置

[g] DB2INSTDEF=db2inst1
[db2inst1@db01 ~]$ db2set DB2COMM=TCPIP
[db2inst1@db01 ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=db01
[g] DB2INSTDEF=db2inst1

6.设置完成后重启db2

db2stop
db2start

7.查看端口​

[db2inst1@db01 ~]$ netstat -an | grep 50000
tcp 0 0 0.0.0.0:50000 0.0.0.0:* LISTEN

版权声明:本文为博主原创文章,未经博主允许不得转载。

Linux,db2