在windows系统下:
命令行窗口下执行:运行--cmd
C:/>netstat -aon|findstr "8080"
TCP 127.0.0.1:80 0.0.0.0:0 LISTENING 2448
端口被进程号为2448的进程占用,继续执行下面命令:
C:/>tasklist|findstr "2448"
thread.exe 2016 Console 0 16,064 K
很清楚,thread占用了你的端口,Kill it
如果第二步查不到,那就开任务管理器,进程---查看---选择列---pid(进程位标识符)打个勾就可以了,
看哪个进程是2448,然后杀之即可。
在Linux系统下:
root用户下
#top
#ps -ef | grep ORA
#netstat -nap | grep 端口号or进程号
#lsof -i :端口号 -n
例如:查看8080端口的使用情况
[root@olivenan root]# lsof -i :8080 -n
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
tnslsnr 1031 oracle 12u IPv4 2013 TCP *:webcache (LISTEN)
[root@olivenan root]# lsof -i tcp:8080 -n
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
tnslsnr 1031 oracle 12u IPv4 2013 TCP *:webcache (LISTEN)
发现8080端口被oracle使用,注意lsof命令参数的使用。
[root@olivenan root]# lsof -i udp:8080 -n
[root@olivenan root]# lsof -i|grep 8080
[root@olivenan root]# netstat -tln|grep 8080
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN