要查看 oracle 數(shù)據(jù)庫監(jiān)聽端口,請(qǐng)執(zhí)行以下步驟:連接到數(shù)據(jù)庫服務(wù)器并查找監(jiān)聽器進(jìn)程。識(shí)別監(jiān)聽器進(jìn)程正在偵聽的端口號(hào)。使用 lsnrctl status 命令列出監(jiān)聽器詳細(xì)信息,包括端口號(hào)、狀態(tài)和連接數(shù)。
如何查看 Oracle 數(shù)據(jù)庫監(jiān)聽端口
Oracle 數(shù)據(jù)庫監(jiān)聽是一個(gè)后臺(tái)進(jìn)程,它偵聽來自客戶端的連接請(qǐng)求并將其路由到適當(dāng)?shù)臄?shù)據(jù)庫實(shí)例。要查看 Oracle 數(shù)據(jù)庫監(jiān)聽端口,請(qǐng)執(zhí)行以下步驟:
1. 連接到數(shù)據(jù)庫服務(wù)器
使用 SSH 或其他安全方法連接到運(yùn)行 Oracle 數(shù)據(jù)庫的服務(wù)器。
2. 查找監(jiān)聽器進(jìn)程
執(zhí)行以下命令以查找監(jiān)聽器進(jìn)程:
<code>ps -ef | grep tnslsnr</code>
登錄后復(fù)制
這將返回所有正在運(yùn)行的偵聽器進(jìn)程的列表。
3. 識(shí)別監(jiān)聽器端口
在輸出中,找到與以下標(biāo)題匹配的行:
<code>-p <port></port></code>
登錄后復(fù)制
<port></port>
是偵聽器正在偵聽的端口號(hào)。
4. 列出監(jiān)聽器詳細(xì)信息
要獲取有關(guān)偵聽器的更多詳細(xì)信息,請(qǐng)執(zhí)行以下命令:
<code>lsnrctl status</code>
登錄后復(fù)制
這將顯示有關(guān)監(jiān)聽器的各種信息,包括端口號(hào)、狀態(tài)和連接數(shù)。
示例輸出:
<code>LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 16-JUN-2021 17:07:23 Copyright (c) 1991, 2017, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host.example.com)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 16-JUN-2021 17:07:23 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Default Service orcl Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/product/12.2.0/dbhome_1/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host.example.com)(PORT=1521))) The listener supports no services</code>
登錄后復(fù)制
在這個(gè)示例中,偵聽器正在偵聽端口 1521。