Oracle RAC下添加靜態註冊監聽器listener

來源:互聯網
上載者:User

通過設定不同的listener,可以在一台伺服器多執行個體c環境下實現業務的隔離,方便業務起停和管理。添加的方法除了netca外,比較簡單的方式是使用srvctl命令,具體用法如下

[grid@dtydb5 ~]$ 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)
    -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

具體過程如下,資料庫是oracle 11gr2版本


1,開始添加 ,使用grid使用者 

[grid@dtydb5 admin]$ srvctl add listener -l listener_epm -p 1522 -o $ORACLE_HOME

2,啟動
srvctl start listener -l listener_epm


啟動後相關檔案才發生變化
[grid@dtydb5 admin]$ cat listener.ora
LISTENER_EPM=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_EPM))))            # line added by Agent
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))            # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))                # line added by Agent
#LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))           # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON                # line added by Agent

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_EPM=ON          # line added by Agent
[grid@dtydb5 admin]$
[grid@dtydb5 admin]$
[grid@dtydb5 admin]$
[grid@dtydb5 admin]$ cat endpoints_listener.ora
LISTENER_EPM_DTYDB5=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dtydb5-vip)(PORT=1522))(ADDRESS=(PROTOCOL=TCP)(HOST=10.4.124.235)(PORT=1522)(IP=FIRST))))                # line added by Agent
LISTENER_DTYDB5=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dtydb5-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=10.4.124.235)(PORT=1521)(IP=FIRST))))            # line added by Agent

3,查看資源的狀態online
ora.LISTENER_EPM.lsnr
               ONLINE  ONLINE       dtydb3                                      
               ONLINE  ONLINE       dtydb4                                      
               ONLINE  ONLINE       dtydb5

[grid@dtydb5 admin]$ lsnrctl status listener_epm

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 13-SEP-2012 10:16:48

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_EPM)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_EPM
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                13-SEP-2012 10:14:17
Uptime                    0 days 0 hr. 2 min. 32 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/11.2.0/grid/log/diag/tnslsnr/dtydb5/listener_epm/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_EPM)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.235)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.245)(PORT=1522)))
The listener supports no services
The command completed successfully

4,vi listener.ora 添加以下資訊,主要要修改三個節點的資訊(後來證實,本步驟可以省略,可能因為靜態監聽資訊已在endpoints_listener.ora檔案中了)

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
     (GLOBAL_DBNAME = epmdb)
     (ORACLE_HOME = /oracle/app/oracle/product/11.2.0/db_1)
     (SID_NAME = epmdb3)
    )
   )

5, 重啟listener
[grid@dtydb5 admin]$ srvctl stop listener -l listener_epm
[grid@dtydb5 admin]$ srvctl start listener -l listener_epm


這時服務還是沒有註冊上來
[grid@dtydb5 admin]$ lsnrctl status listener_epm

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 13-SEP-2012 10:27:15

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_EPM)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_EPM
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                13-SEP-2012 10:26:35
Uptime                    0 days 0 hr. 0 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/11.2.0/grid/log/diag/tnslsnr/dtydb5/listener_epm/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_EPM)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.235)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.245)(PORT=1522)))
The listener supports no services
The command completed successfully

6,什麼原因?應該是local_listener設定問題,還需要修改該參數

sys@EPMDB3(dtydb5)> show parameter local

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      (DESCRIPTION=(ADDRESS_LIST=(AD
                                                 DRESS=(PROTOCOL=TCP)(HOST=10.4
                                                 .124.245)(PORT=1521))))

sys@EPMDB3(dtydb5)> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.4.124.245)(PORT=1522))))' scope=both sid='*';

系統已更改。
 alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.4.124.243)(PORT=1522))))' scope=both sid='epmdb1';
  alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.4.124.244)(PORT=1522))))' scope=both sid='epmdb2';
   alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.4.124.245)(PORT=1522))))' scope=both sid='epmdb3';

 

7,已成功註冊
[grid@dtydb5 admin]$ lsnrctl status  LISTENER_EPM

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 13-SEP-2012 10:40:47

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_EPM)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_EPM
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                13-SEP-2012 10:26:35
Uptime                    0 days 0 hr. 14 min. 12 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/11.2.0/grid/log/diag/tnslsnr/dtydb5/listener_epm/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_EPM)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.235)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.245)(PORT=1522)))
Services Summary...
Service "epmdb" has 1 instance(s).
  Instance "epmdb3", status READY, has 1 handler(s) for this service...
The command completed successfully

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.