温馨提示×

怎样用lsnrctl查看监听端口

小樊
45
2025-07-24 05:14:14
栏目: 编程语言

lsnrctl 是 Oracle 数据库的一个命令行工具,用于管理和监控 Oracle 数据库的监听器。要使用 lsnrctl 查看监听端口,请按照以下步骤操作:

  1. 打开命令提示符(Windows)或终端(Linux/Unix/Mac)。

  2. 输入 lsnrctl 命令并按 Enter 键。这将启动 lsnrctl 工具并显示其命令提示符。

  3. lsnrctl 命令提示符下,输入 status 命令并按 Enter 键。这将显示监听器的状态信息,包括监听端口。

示例输出:

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 01-JAN-2021 12:34:56 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost.example.com)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 01-JAN-2021 12:34:56 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/myhost/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost.example.com)(PORT=1521))) Services Summary... Service "CLRExtProc" has 1 instance(s). Instance "clrextproc", status READY, has 1 handler(s) for this service... Service "mydb" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... The command completed successfully 

在 “Listening Endpoints Summary” 部分,您可以看到监听端口(在本例中为 1521)。请注意,您需要根据实际情况替换示例输出中的主机名和端口号。

0