OCM备考 一、Server config 之网络配置
OCM考試大綱關于network配置的要求
一?Server Configuration
﹡?Create and manage multiple network configuration files?
﹡?Create and configure a listener
﹡?Set up network tracing
?
oracle網絡配置主要包括對listener、本地命名服務的配置,下述內容概括了網絡配置的主要知識點:
?
1、 怎么創建第一個listener
?????創建數據庫之前,最好先創建listener。可以通過oui、netca、netmgr等oracle提供圖形化工具,也可以通過編輯listener.ora文件來創建listener(使用圖形化工具也是對listener.ora文件作了修改)。創建第一個listener后(采用默認1521端口),listener.ora內容如下:
LISTENER=
??(DESCRIPTION=
????(ADDRESS_LIST=
??????(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.155.2)(PORT=1521))
??????(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
# 上面部分定義listener名稱、服務器地址和端口
SID_LIST_LISTENER=
??(SID_LIST=
????(SID_DESC=
??????(SID_NAME=plsextproc)
??????(ORACLE_HOME=/oracle10g)
??????(PROGRAM=extproc)))
# 上面部分定義需要靜態注冊的服務,靜態注冊和動態注冊的區別見后面,這里是提供給C、C++等程序訪問數據庫的外部程序接口進行靜態注冊,這類接口不能采用動態注冊。
?
2、怎么為listener增加IP
???為了滿足網絡冗余功能,如在服務器具有多塊網卡的情況下,可以為一個listener綁定多個ip。同樣可以通過netca、netmgr等圖形化工具,或直接通過編輯listener.ora來實現。增加ip后的listener.ora文件內容為:
LISTENER =
??(DESCRIPTION_LIST =
????(DESCRIPTION =
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.2)(PORT = 1521))
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.10)(PORT = 1521))
????)
????(DESCRIPTION =
??????(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
????)
)
# 192.168.155.10是為listener新增加的ip
SID_LIST_LISTENER =
??(SID_LIST =
???4 (SID_DESC =
??????(SID_NAME = PLSExtProc)
??????(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
??????(PROGRAM = extproc)
????)
??)
?
3、怎么為listener配置多個監聽端口(同一IP)
在同一IP地址上為listener增加端口1525:
修改listener.ora
LISTENER =
??(DESCRIPTION_LIST =
????(DESCRIPTION =
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1525)) - 增加新的監聽端口
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1521))
????)
????(DESCRIPTION =
??????(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
????)
??)
修改tnsnames.ora
OA =
??(DESCRIPTION =
????(ADDRESS_LIST =
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1525)) - 服務能解析到新端口
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1521))
????)
????(LOAD_BALANCE = YES)???- 可選
????(FAILOVER = YES)??- 可選
????(CONNECT_DATA =
??????(SERVICE_NAME = oa.oracle.com)
????)
)
?
由于采用了非默認端口(1525),如果要實現動態注冊設置local_listener參數,先在tnsnames.ora中配置(如果采用靜態注冊,則只需要在listener.ora中修改SID_LIST_LISTENERNAME,加入service配置):
LOCAL_LISTENER =
??(DESCRIPTION =
????(ADDRESS_LIST =
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1525))
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1521))
????)
??)
然后修改local_listener參數:
Sql> alter system set local_listener=LOCAL_LISTENER scope=both;
?
4、?增加新的listener
???可以通過創建多個listener,實現listener冗余。可以通過圖形化工具或編輯listener.ora實現,增加后listener.ora內容為:
LISTENER =
??(DESCRIPTION_LIST =
????(DESCRIPTION =
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.2)(PORT = 1521))
????)
????(DESCRIPTION =
??????(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
????)
)
LISTENER1 =
??(DESCRIPTION_LIST =
????(DESCRIPTION =
??????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.10)(PORT = 1521))
????)
????(DESCRIPTION =
??????(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
????)
)
#新增listener1,ip為192.168.155.10
SID_LIST_LISTENER =
??(SID_LIST =
???4 (SID_DESC =
??????(SID_NAME = PLSExtProc)
??????(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
??????(PROGRAM = extproc)
????)
??)
5、 管理遠程服務器上的listener
??(DESCRIPTION =
????(ADDRESS_LIST =
??????(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
????)
????(CONNECT_DATA =
??????(SERVER = DEDICATED)
??????(SERVICE_NAME = erp)
????)
??) 將erp服務注冊到listener: sql> alter system register; 查看注冊到listener的service: $ lsnrctl status Service "erp" has 1 instance(s).
??Instance "orcl", status READY, has 4 handler(s) for this service... #狀態READY代表是采用了動態注冊方式。 ? 2)靜態注冊 將要注冊的service增加到listener.ora中,listener啟動時讀取listener.ora中定義的service并將其注冊。 如listener.ora增加erp服務: SID_LIST_LISTENER =
??(SID_LIST =
????(SID_DESC =
??????(GLOBAL_DBNAME = erp) -- global_dbname這里代表service名稱
??????(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
??????(SID = orcl)
????)
??) 在tnsnames.ora解析erp服務,方法同動態注冊。 啟動listener: $ lsnrctl stop; 當前注冊到listener的服務狀態: Service "erp" has 1 instance(s).
??Instance "erp", status UNKNOWN, has 1 handler(s) for this service...
服務狀態unknonw,代表服務是靜態注冊到listener。
總結
以上是生活随笔為你收集整理的OCM备考 一、Server config 之网络配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OCM备考 一、Server confi
- 下一篇: OCM备考 三. Managing Da