温馨提示×

ubuntu lsnrctl命令有哪些

小樊
49
2026-10-22 21:43:56
栏目: 智能运维

在 Ubuntu(或其他 Linux 发行版)上,lsnrctl 是 Oracle Database Listener Control Utility,用于管理 Oracle 监听程序(Listener)。它并不是 Ubuntu 自带命令,而是 安装 Oracle 数据库或 Oracle Client 后 才有的。

下面是 lsnrctl 常用命令分类说明。


一、基本使用方式

lsnrctl <command> [listener_name]

如果省略 listener_name,默认使用 LISTENER。


二、常用 lsnrctl 命令

1. 启动 / 停止 / 重启

lsnrctl start          # 启动默认监听器
lsnrctl start LISTENER # 启动指定监听器
lsnrctl stop           # 停止监听器
lsnrctl reload         # 重新加载配置(不中断连接)

2. 查看状态

lsnrctl status
lsnrctl status LISTENER

显示:

  • 监听器版本
  • 监听端口
  • 服务名(Service)
  • 当前连接数

3. 查看服务

lsnrctl services
lsnrctl services LISTENER

查看监听器当前注册的服务和实例


4. 查看监听器参数

lsnrctl show
lsnrctl show LISTENER

可显示:

  • 日志路径
  • 跟踪级别
  • 监听地址等

5. 修改运行参数(临时)

lsnrctl set log_status on
lsnrctl set trc_level admin

⚠️ 这些是运行时参数,重启后失效


6. 帮助

lsnrctl help
lsnrctl ?

三、监听器配置文件(不是 lsnrctl 命令,但很重要)

$ORACLE_HOME/network/admin/listener.ora

常用参数:

  • LISTENER
  • PORT
  • HOST
  • SID_LIST_LISTENER

修改后通常执行:

lsnrctl reload

四、常见问题(Ubuntu)

1. 命令找不到

lsnrctl: command not found

解决:

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

2. Ubuntu 上没有 lsnrctl

说明:

  • 没装 Oracle
  • 或只装了 MySQL / PostgreSQL

五、常用组合示例

lsnrctl start
lsnrctl status
lsnrctl services

如果你愿意,可以告诉我:

  • ✅ Ubuntu 版本
  • ✅ 是否已安装 Oracle
  • ✅ 报错信息

我可以给你更精确的命令或排错步骤。

0 踩