監聽服務和訪問連接原理
端口號范圍:1025~6500
[oracle@oracle3 ~]$ lsnrctl --進入監聽管理工具
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 05-JUN-2014 11:13:20
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status --查看監聽器狀態
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 05-JUN-2014 09:38:27
Uptime 0 days 1 hr. 34 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1521))) --端口號默認是1521,也就是對外提供服務的端口號。
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCL_XPT" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
SQL> conn system/orcl@ORCL33 --通過監聽器訪問
已連接。
ORCL33叫做網絡服務名(連接描述符),配置文件在客戶端,服務器上不需要的。
F:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora --客戶端的路徑.網絡服務名配置文件
文件中:
ORCL33 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.3.3)(PORT = 1521)) --oracle server的IP,端口號,數據庫名字
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
添加連接串兩種方法:1、通過圖形界面 2、直接修改這個文件
本地直接訪問,不需要經過監聽器,宿主機訪問是必須通過監聽器的。
用xmanager連接:
SQL> conn system/orcl --本機訪問
Connected.
SQL> conn system/orcl@ORCL --本機通過監聽器訪問
Connected.
將監聽器停止
[oracle@oracle3 admin]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 05-JUN-2014 11:28:28
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
SQL> conn system/orcl --本機訪問不受影響
Connected.
SQL> conn system/orcl@ORCL --通過監聽器訪問不能連接
ERROR:
ORA-12541: TNS:no listener
Warning: You are no longer connected to ORACLE.
SQL> conn system/orcl@ORCL2567
ERROR:
ORA-12541: TNS: 無監聽程序
警告: 您不再連接到 ORACLE。
啟動監聽后查看狀態:
[oracle@oracle3 admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 05-JUN-2014 11:31:39
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 05-JUN-2014 11:30:50
Uptime 0 days 0 hr. 0 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully --此時還是不能遠端訪問的,因為數據庫還沒監聽到
此時連接:
SQL> conn system/orcl@ORCL2567
ERROR:
ORA-12541: TNS: 無監聽程序
警告: 您不再連接到 ORACLE。
[oracle@oracle3 admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 05-JUN-2014 11:31:46
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 05-JUN-2014 11:30:50
Uptime 0 days 0 hr. 0 min. 55 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service... --數據庫被監聽到
Service "ORCLXDB" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCL_XPT" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
SQL> conn system/orcl@ORCL2567 --此時遠端訪問正常
已連接。
簡單的檢測方法:
C:\Users\Administrator>tnsping ORCL2567 --ping網路描述符是否是可以訪問通的
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 05-6月 -
2014 11:38:41
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的參數文件:
F:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora
已使用 TNSNAMES 適配器來解析別名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 10.1.3.3)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORCL)))
OK (30 毫秒)
[oracle@oracle3 admin]$ tnsping ORCL1
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 05-JUN-2014 11:41:09
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
/u01/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
TNS-03505: Failed to resolve name --ping不通的表現
另外有需要云服務器可以了解下創新互聯cdcxhl.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
網頁名稱:oracle的環境配置-監聽服務和訪問連接原理-創新互聯
標題鏈接:http://m.newbst.com/article14/dhcege.html
成都網站建設公司_創新互聯,為您提供云服務器、外貿網站建設、網站改版、小程序開發、做網站、品牌網站設計
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯