在 Debian 下使用 lsnrctl 启动 Oracle 监听(Listener),一般步骤如下:
lsnrctl 是 Oracle Database 自带的工具,需要先安装 Oracle 数据库软件(通常是 Oracle 19c / 21c 等)。
确认:
which lsnrctl
如果没有命令,说明 Oracle 环境变量未配置。
Oracle 一般不建议用 root 启动:
su - oracle
执行 Oracle 环境变量(根据实际安装路径):
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orcl
(若已有 .bash_profile,可直接 source ~/.bash_profile)
lsnrctl start
如果监听名不是默认 LISTENER:
lsnrctl start LISTENER
lsnrctl status
看到类似:
STATUS of the LISTENER
----------------------
Alias LISTENER
Version TNSLSNR for Linux
...
Services Summary...
说明启动成功。
TNS-01106: Listener using listener name LISTENER already started说明监听已在运行。
TNS-12545: Connect failed because target host or object does not exist检查:
/etc/hostslistener.ora 中的 HOSTDebian 官方源 没有 Oracle,需手动安装 Oracle 或改用 PostgreSQL / MySQL。
如果你愿意,可以告诉我:
我可以一步步帮你排错。