在 Ubuntu(或其他 Linux 发行版)上,lsnrctl 是 Oracle Database Listener Control Utility,用于管理 Oracle 监听程序(Listener)。它并不是 Ubuntu 自带命令,而是 安装 Oracle 数据库或 Oracle Client 后 才有的。
下面是 lsnrctl 常用命令分类说明。
lsnrctl <command> [listener_name]
如果省略 listener_name,默认使用 LISTENER。
lsnrctl start # 启动默认监听器
lsnrctl start LISTENER # 启动指定监听器
lsnrctl stop # 停止监听器
lsnrctl reload # 重新加载配置(不中断连接)
lsnrctl status
lsnrctl status LISTENER
显示:
lsnrctl services
lsnrctl services LISTENER
查看监听器当前注册的服务和实例
lsnrctl show
lsnrctl show LISTENER
可显示:
lsnrctl set log_status on
lsnrctl set trc_level admin
⚠️ 这些是运行时参数,重启后失效
lsnrctl help
lsnrctl ?
$ORACLE_HOME/network/admin/listener.ora
常用参数:
LISTENERPORTHOSTSID_LIST_LISTENER修改后通常执行:
lsnrctl reload
lsnrctl: command not found
解决:
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
说明:
lsnrctl start
lsnrctl status
lsnrctl services
如果你愿意,可以告诉我:
我可以给你更精确的命令或排错步骤。