温馨提示×

debian lsnrctl怎样查监听

小樊
42
2026-09-12 13:09:38
栏目: 智能运维

在 Debian 上,lsnrctlOracle Database Listener 的管理工具(通常随 Oracle 客户端或数据库安装)。用来查看监听状态,一般步骤如下:


1. 确认 lsnrctl 是否可用

which lsnrctl

lsnrctl status

如果提示 command not found,需要先设置 Oracle 环境变量。


2. 设置 Oracle 环境变量(常见)

export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orcl

(路径根据你实际安装情况修改)


3. 查看监听状态(最常用)

lsnrctl status

输出示例:

Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
Services Summary...
  Service "orcl" has 1 instance(s).

4. 查看指定监听器

如果配置了多个监听器(如 LISTENER2):

lsnrctl status LISTENER2

5. 查看监听器参数(监听地址、端口)

lsnrctl services

lsnrctl show

6. 启动 / 停止监听(补充)

lsnrctl start
lsnrctl stop

常见问题

  • Debian 默认没有 lsnrctl,必须安装 Oracle 软件
  • 若监听没起来:
    lsnrctl start
    
  • 检查端口监听:
    netstat -tulnp | grep 1521
    # 或
    ss -tulnp | grep 1521
    

如果你是想 不用 Oracle 看端口监听(比如普通服务),可以用:

ss -tulnp

netstat -tulnp

需要我帮你判断是 Oracle 监听 还是 系统端口监听 吗?

0