环境:Oracle 11Gr1+Linux Redhat 5

重启机器后,数据库监听启动报错如下:

TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use

经过查看listener,ora 和日志 都说是地址被占用

可以用命令查看1521端口是否被程序占用

netstat -ntulp|grep 1521

结果看到 4078/sshd 进程在占用1521端口

想起前两天为了测试java进程,把1521端口加到sshd里面的

查看/etc/ssh/sshd_conf

[root@localhost conf]# more /etc/ssh/sshd_config

#       $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

 

# This is the sshd server system-wide configuration file.  See

# sshd_config(5) for more information.

 

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

 

# The strategy used for options in the default sshd_config shipped with

# OpenSSH is to specify options with their default value where

# possible, but leave them commented.  Uncommented options change a

# default value.

 

Port 22

Port 7088

Port 8088

Port 5222

Port 9880

Port 8091

Port 1521

Port 9080

Port 21

#Protocol 2,1

Protocol 2

#AddressFamily any

#ListenAddress 0.0.0.0

#ListenAddress ::

发现加了很多端口,其中包含1521也被sshd占用,原先把sshd进程杀了,开监听可以成功了,但sshd服务被杀了,远程不了,就把如上文件的除 22 端口,其他都屏蔽了
再开启监听和sshd服务,任务完成
 
结论:netstat -ntulp|grep 1521 查看是否有程序进程在占用 1521端口