步驟如下: 檢查預設network的network number,紅色字體1,一會兒添加監聽會用到: 查看srvctl添加監聽的語法: 添加監聽:名稱: LISTENER4 埠號:1524 創建完後會在配置文件endpoints_listener.ora和listener.ora中添加記錄信息: ...
步驟如下:
檢查預設network的network number,紅色字體1,一會兒添加監聽會用到:
[grid@rac121 admin]$ srvctl config network Network exists: 1/10.1.252.0/255.255.255.0/eth0, type static
查看srvctl添加監聽的語法:
[grid@rac121 admin]$ srvctl add listener -h Adds a listener configuration to the Oracle Clusterware. Usage: srvctl add listener [-l <lsnr_name>] [-s] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-o <oracle_home>] [-k <net_num>] -l <lsnr_name> Listener name (default name is LISTENER) #監聽名稱 -o <oracle_home> ORACLE_HOME path (default value is CRS_HOME) #grid的HOME -k <net_num> network number (default number is 1) #最開始查看的網路號 -s Skip the checking of ports -p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]" Comma separated tcp ports or listener endpoints #要添加的埠號 -h Print usage
添加監聽:名稱: LISTENER4 埠號:1524
[grid@rac121 ~]$ srvctl add listener -l LISTENER4 -o $ORACLE_HOME -p 1524 -k 1 [grid@rac121 ~]$ srvctl start listener -l LISTENER4
創建完後會在配置文件endpoints_listener.ora和listener.ora中添加記錄信息:
[grid@rac121 admin]$ ls endpoints_listener.ora listener1206183PM1248.bak listener.ora samples sqlnet1206199AM0038.bak endpoints_listener.ora.bak.rac121 listener1206199AM0038.bak listener.ora.bak.rac121 shrept.lst sqlnet.ora
查看添加 的信息:兩個文件聽紅色字體部分
[grid@rac121 admin]$ cat listener.ora LISTENER4=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER4)))) # line added by Agent NEW_RACDB_LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=NEW_RACDB_LISTENER)))) # line added by Agent # listener.ora Network Configuration File: /oradata/oracleapp/11.2.0/grid/network/admin/listener.ora # Generated by Oracle configuration tools. [grid@rac121 admin]$ cat endpoints_listener.ora LISTENER4_RAC121=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac121-vip)(PORT=1524))(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.252.121)(PORT=1524)(IP=FIRST)))) # line added by Agent NEW_RACDB_LISTENER_RAC121=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac121-vip)(PORT=1523))(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.252.121)(PORT=1523)(IP=FIRST)))) # line added by Agent RACDB_LISTENER_RAC121=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac121-vip)(PORT=1522))(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.252.121)(PORT=1522)(IP=FIRST)))) # line added by Agent LISTENER_RAC121=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac121-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.252.121)(PORT=1521)(IP=FIRST)))) # line added by Agent
到此完成了監聽的添加,再添加靜態註冊信息,vi listener.ora文件,在裡面添加如下內容:
SID_LIST_LISTENER4 = #對應的監聽名 (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = RACDB) (ORACLE_HOME = /oradata/oracleapp/11.2.0/grid) (SID_NAME = RACDB1) #節點對應的SID ) )
重啟監聽即完成靜態註冊:
[grid@rac121 admin]$ srvctl stop listener -l LISTENER4 [grid@rac121 admin]$ srvctl start listener -l LISTENER4 [grid@rac121 admin]$ lsnrctl status LISTENER4 LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 19-JUN-2012 15:48:47 Copyright (c) 1991, 2011, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER4))) STATUS of the LISTENER ------------------------ Alias LISTENER4 Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production Start Date 19-JUN-2012 15:48:35 Uptime 0 days 0 hr. 0 min. 11 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /oradata/oracleapp/11.2.0/grid/network/admin/listener.ora Listener Log File /oradata/oracleapp/11.2.0/grid/log/diag/tnslsnr/rac121/listener4/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER4))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.252.121)(PORT=1524))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.252.75)(PORT=1524))) Services Summary... Service "RACDB" has 1 instance(s). Instance "RACDB1", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [grid@rac121 admin]$
查看所有的監聽狀態:
grid@rac121 admin]$ srvctl status listener Listener LISTENER is enabled Listener LISTENER is running on node(s): rac121,rac122 Listener LISTENER4 is enabled Listener LISTENER4 is running on node(s): rac121,rac122 Listener NEW_RACDB_LISTENER is enabled Listener NEW_RACDB_LISTENER is running on node(s): rac121,rac122 Listener RACDB_LISTENER is enabled Listener RACDB_LISTENER is running on node(s): rac121,rac122
查看各個監聽的配置:
[grid@rac121 admin]$ srvctl config listener -a Name: LISTENER Network: 1, Owner: grid Home: <CRS home> /oradata/oracleapp/11.2.0/grid on node(s) rac122,rac121 End points: TCP:1521 Name: LISTENER4 Network: 1, Owner: grid Home: <CRS home> /oradata/oracleapp/11.2.0/grid on node(s) rac122,rac121 End points: TCP:1524 Name: NEW_RACDB_LISTENER Network: 1, Owner: grid Home: <CRS home> /oradata/oracleapp/11.2.0/grid on node(s) rac122,rac121 End points: TCP:1523 Name: RACDB_LISTENER Network: 1, Owner: grid Home: <CRS home> /oradata/oracleapp/11.2.0/grid on node(s) rac122,rac121 End points: TCP:1522
到此就利用srvctl管理工具完成了添加新監聽和靜態註冊的任務。