Port usage warning (SQL5043N)
When an instance is started (using the db2start command), listeners are also started to accept the connect request from clients. However, there are instances where the listeners may fail to start because the port that they are listening to may be used by a different application, which throws a SQL5043N warning.
2007-01-23-18.104.22.1685991-300 LEVEL: Error PID : 3268824 TID : 1 PROC : db2sysc 0 INSTANCE: db2inst1 NODE : 000 FUNCTION: DB2 UDB, common communication, sqlcctcpconnmgr, probe:46 MESSAGE : ADM7007E The SVCENAME DBM configuration parameter, "50000", is configured with a port or a service name. When it is configured with a service name, the TCP/IP services files is used to map the service name to a port number. The port specified in this field is being used by another process. Resolve this problem by either deleting the process using the port or use another port.
The example db2diag.log file shows that the TCP/IP listener
(db2tcpcm) failed to start because the required port, port
in this example, was already being used by another application. The simple resolution is to use a
different port for the listener. If you have to use that specific port, you should terminate the
application that's using it.
- Run the following command:
lsof -i :<port number>
This command must be run as root.
SVCENAMEto 50000, so that the listener will use this port:
$ db2 update dbm cfg using svcename 50000 $ db2start
$ lsof -i :50000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME db2sysc 4128774 db2inst1 5u IPv6 0xf1000e00019f3bb8 0t0 TCP *:50000 (LISTEN)
- Run the following
netstat -aon | findstr "<port number>"
Running this command shows if the specified
<port number>is being used. The number in the last column is the process id (PID) of the process holding the socket. Once PID is determined, you can refer to the "Windows Task Manager" to determine which application corresponds to the PID.
C:\>netstat -aon | findstr "50000" TCP 0.0.0.0:50000 0.0.0.0:0 LISTENING 2564 C:\>pslist 2564 pslist v1.28 - Sysinternals PsList Copyright ⌐ 2000-2004 Sysinternals Process information for MACHINENAME: Process information for MACHINENAME: Name Pid Pri Thd Hnd Priv CPU Time Elapsed Time db2syscs 2564 8 15 366 30912 0:00:02.859 2:12:08.564
- Run the following command:
netstat -anp | grep <port number>
This command shows the PID and the program name that uses that port. The command must be run as root.
- Alternatively, you can also run the following command
fuser -n tcp <port number>
# netstat -anp | grep 12345 # netstat -anp | grep 12345 tcp 0 0 127.0.0.1:12345 0.0.0.0:* LISTEN 6629/ssh tcp 0 0 ::1:12345 :::* LISTEN 6629/ssh
# ps -efl | grep 6629 4 S root 6629 29716 0 75 0 - 6976 - 14:05 pts/4 00:00:00 ssh testserver -D 12345 -l db2inst1 0 S root 7648 7302 0 78 0 - 742 pipe_w 14:07 pts/7 00:00:00 grep 6629
In this case, the user db2inst1 is deliberately using port 12345 by specifying
-D option of ssh.