在 Debian 上,lsnrctl 是 Oracle Database Listener 的管理工具(通常随 Oracle 客户端或数据库安装)。用来查看监听状态,一般步骤如下:
which lsnrctl
或
lsnrctl status
如果提示 command not found,需要先设置 Oracle 环境变量。
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orcl
(路径根据你实际安装情况修改)
lsnrctl status
输出示例:
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
如果配置了多个监听器(如 LISTENER2):
lsnrctl status LISTENER2
lsnrctl services
或
lsnrctl show
lsnrctl start
lsnrctl stop
lsnrctl start
netstat -tulnp | grep 1521
# 或
ss -tulnp | grep 1521
如果你是想 不用 Oracle 看端口监听(比如普通服务),可以用:
ss -tulnp
或
netstat -tulnp
需要我帮你判断是 Oracle 监听 还是 系统端口监听 吗?