##第二. Oracle Network配置web
配置和管理Oracle Network 的工具:sql
- Enterprise Manager 的「Net Services Administration(網絡服務管理)」頁
- 提供一個圖形用戶界面(GUI),經過這個界面可在本地客戶機 或服務器主機的Oracle 主目錄中配置Oracle Net Services。Oracle Net Manager 容許您在本地客戶機或服務器主機的Oracle 主目錄中配置Oracle Net Services。可使用Net Manager 配置如下網絡組件: - 命名:定義簡單的名稱和鏈接標識符,並將它們映射至鏈接描述符以肯定網絡位置和服務標識。Oracle Net Manager 支持在本地tnsnames.ora 文件或集中式目錄服務中配置鏈接描述符。 - 命名方法:配置將鏈接標識符解析爲鏈接描述符的不一樣方法。 - 概要文件:配置用於在客戶機或服務器上啓用和配置Oracle Net 功能的首選項。配置sqlnet.ora 參數。 - 監聽程序:建立和配置監聽程序以接收客戶機鏈接。listener.ora
- 安裝Oracle 軟件時經過Oracle Universal Installer來啓動。使用Oracle Net Configuration Assistant 可配置Oracle DB 的監聽協議地址和服務信息。在典型的數據庫安裝期間,Oracle Net Configuration Assistant 會自動配置一個名爲LISTENER 的監聽程序,該監聽程序具備數據庫的TCP/IP 監聽協議地址。 若是執行定製安裝,則Oracle Net Configuration Assistant 會提示您配置所選的監聽程序名稱和協議地址。安裝數據庫以後,使用Oracle Net Configuration Assistant 進行初始網絡配置。而後,可使用Oracle Enterprise Manager 和Oracle Net Manager 配置和管理您的網絡。
- 命令行 用於啓動、中止監聽程序進程或查看監聽程序進程的狀態。
- 動態服務註冊:oracle 10g以上 用netca方式創建的都默認爲動態註冊方式。
status READY
- listener實時的都知道實例的狀態,數據庫在關閉的時候會動態的從listener中註銷。 - 當數據庫關閉的時候,就沒法遠程的啓動數據庫。
LSNRCTL> status listener Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production Start Date 29-MAY-2015 02:40:43 Uptime 0 days 4 hr. 48 min. 35 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /home/oracle/app/oracle/diag/tnslsnr/hzvscmdb/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hzvscmdb.qa.webex.com)(PORT=1521))) Services Summary... Service "tonytest.qa.webex.com" has 1 instance(s). Instance "tonytest", status READY, has 1 handler(s) for this service... Service "tonytestXDB.qa.webex.com" has 1 instance(s). Instance "tonytest", status READY, has 1 handler(s) for this service... The command completed successfully
- 靜態服務註冊:
status UNKNOWN
- listener不知道實例的狀態,只有在進程經過其鏈接數據庫時才能知道,若是你想使用遠程管理數據庫就使用靜態監聽。 - 能夠遠程起數據庫。
LSNRCTL> status listener2 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.200)(PORT=1523))) STATUS of the LISTENER ------------------------ Alias listener2 Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production Start Date 29-MAY-2015 05:05:23 Uptime 0 days 2 hr. 25 min. 13 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /home/oracle/app/oracle/diag/tnslsnr/hzvscmdb/listener2/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.200)(PORT=1523))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.200)(PORT=1524))) Services Summary... Service "tonytest.qa.webex.com" has 1 instance(s). Instance "tonytest", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully ################################################################### [oracle@hzvscmdb admin]$ more listener.ora LISTENER2 = (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.200)(PORT=1523)) (ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.200)(PORT=1524)) ) ) SID_LIST_LISTENER2= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME=tonytest.qa.webex.com) (SID_NAME=tonytest) (ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1) ) ) 注:LISTENER2 和 SID_LIST_LISTENER2 名字匹配
- 手工註冊監聽
alter system register;
- 修改動態註冊的默認端口1521 方法一
Alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.200)(PORT = 1522))' alter system register;
- 方法二
[oracle@hzvscmdb admin]$ more listener.ora LISTENER1 = (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.200)(PORT=1522)) ) ) SID_LIST_LISTENER1= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME=tonytest.qa.webex.com) (SID_NAME=tonytest) (ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1) ) ) [oracle@hzvscmdb admin]$ more tnsnames.ora LISTENER1= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.200)(PORT = 1522)) ) SQL*Plus: Release 11.2.0.2.0 Production on Fri May 29 09:54:22 2015 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning option SQL> Alter system set local_listener= LISTENER1; SQL> alter system register; SQL> show parameter local_listener; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ local_listener string LISTENER1
說明:LISTENER2註冊的實例和服務器默認的監聽同樣,listener status,也就是默認的監聽狀態,咱們發現,動態監聽沒有了,剩下的靜態監聽。更進一步,咱們發現,只要咱們成功設置了local_listener的值,包括實例和服務名不和默認監聽同樣,PMON都會在等待local_listener對應的監聽。數據庫
LSNRCTL> status listener1 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.200)(PORT=1522))) STATUS of the LISTENER ------------------------ Alias listener1 Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production Start Date 29-MAY-2015 09:49:26 Uptime 0 days 0 hr. 9 min. 2 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /home/oracle/app/oracle/diag/tnslsnr/hzvscmdb/listener1/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.200)(PORT=1522))) Services Summary... Service "tonytest.qa.webex.com" has 2 instance(s). Instance "tonytest", status UNKNOWN, has 1 handler(s) for this service... Instance "tonytest", status READY, has 1 handler(s) for this service... Service "tonytestXDB.qa.webex.com" has 1 instance(s). Instance "tonytest", status READY, has 1 handler(s) for this service... The command completed successfully