溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

oracle11g rac監(jiān)聽(tīng)配置的示例分析

發(fā)布時(shí)間:2021-11-16 14:41:02 來(lái)源:億速云 閱讀:196 作者:小新 欄目:關(guān)系型數(shù)據(jù)庫(kù)

這篇文章主要介紹了oracle11g rac監(jiān)聽(tīng)配置的示例分析,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

(1)概述
rac配置如下:

[grid@dbrac1 admin]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.56.2    dbrac1
192.168.56.3    dbrac1-vip
10.10.10.10     dbrac1-priv

192.168.56.4    dbrac2
192.168.56.5    dbrac2-vip
10.10.10.11     dbrac2-priv

192.168.56.8   rac-scan
[grid@dbrac1 admin]$

一、查看節(jié)點(diǎn)1的oracle、grid用戶下的監(jiān)聽(tīng)及tns配置文件
oracle用戶下:
[oracle@dbrac1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

DBRAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dbrac)
    )
  )

[oracle@dbrac1 admin]$
[oracle@dbrac1 admin]$ sqlplus  / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 19 10:12:34 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      dbrac
db_unique_name                       string      dbrac
global_names                         boolean     FALSE
instance_name                        string      dbrac1
lock_name_space                      string
log_file_name_convert                string
processor_group_name                 string
service_names                        string      dbrac
SQL>
SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string       (ADDRESS=(PROTOCOL=TCP)(HOST=
                                                 192.168.56.3)(PORT=1521))
remote_listener                      string      rac-scan:1521
SQL>


grid用戶下:
[grid@dbrac1 ~]$ cd $ORACLE_HOME/network/admin
[grid@dbrac1 admin]$ ls -lrt
total 28
-rw-r--r-- 1 grid oinstall  381 Dec 17  2012 shrept.lst
drwxr-xr-x 2 grid oinstall 4096 Oct 16 20:40 samples
-rw-r--r-- 1 grid oinstall  184 Oct 16 20:59 listener.ora.bak.dbrac1
-rw-r--r-- 1 grid oinstall  184 Oct 16 21:10 listener1710169PM1019.bak
-rw-r--r-- 1 grid oinstall  222 Oct 16 21:10 sqlnet.ora
-rw-r--r-- 1 grid oinstall  350 Oct 16 21:10 listener.ora
-rw-r--r-- 1 grid oinstall  185 Oct 16 21:10 endpoints_listener.ora
[grid@dbrac1 admin]$

--endpoints_listener.ora文件:
[grid@dbrac1 admin]$ cat endpoints_listener.ora
LISTENER_DBRAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dbrac1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.2)(PORT=1521)(IP=FIRST))))     # line added by Agent
[grid@dbrac1 admin]$

--listener.ora監(jiān)聽(tīng)配置文件:
[grid@dbrac1 admin]$ cat listener.ora
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
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON                # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
[grid@dbrac1 admin]$

--sqlnet.ora文件:
[grid@dbrac1 admin]$ cat sqlnet.ora
# sqlnet.ora.dbrac1 Network Configuration File: /oracle/app/11.2.0/grid/network/admin/sqlnet.ora.dbrac1
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

ADR_BASE = /oracle/app/grid

[grid@dbrac1 admin]$       
[grid@dbrac1 admin]$


二、查看節(jié)點(diǎn)2的oracle、grid用戶下的監(jiān)聽(tīng)及tns配置文件
oracle用戶下:
[oracle@dbrac2 ~]$ cd $ORACLE_HOME/network/admin
[oracle@dbrac2 admin]$ ls
samples  shrept.lst  tnsnames.ora
[oracle@dbrac2 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

DBRAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dbrac)
    )
  )

[oracle@dbrac2 admin]$
[oracle@dbrac2 admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 19 14:49:34 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      dbrac
db_unique_name                       string      dbrac
global_names                         boolean     FALSE
instance_name                        string      dbrac2
lock_name_space                      string
log_file_name_convert                string
processor_group_name                 string
service_names                        string      dbrac
SQL>
SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string       (ADDRESS=(PROTOCOL=TCP)(HOST=
                                                 192.168.56.5)(PORT=1521))
remote_listener                      string      rac-scan:1521
SQL>


grid用戶下:
[grid@dbrac2 ~]$ cd $ORACLE_HOME/network/admin
[grid@dbrac2 admin]$ ls -lrt
total 28
-rw-r--r-- 1 grid oinstall  381 Oct 16 20:48 shrept.lst
drwxr-xr-x 2 grid oinstall 4096 Oct 16 20:48 samples
-rw-r--r-- 1 grid oinstall  222 Oct 16 21:10 sqlnet.ora
-rw-r--r-- 1 grid oinstall  166 Oct 16 21:10 listener.ora.bak.dbrac2
-rw-r--r-- 1 grid oinstall  185 Oct 16 21:10 endpoints_listener.ora
-rw-r--r-- 1 grid oinstall  350 Oct 16 23:33 listener.bak
-rw-r--r-- 1 grid oinstall  481 Oct 19 10:31 listener.ora

--endpoints_listener.ora文件:
[grid@dbrac2 admin]$ cat endpoints_listener.ora
LISTENER_DBRAC2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dbrac2-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.4)(PORT=1521)(IP=FIRST))))     # line added by Agent
[grid@dbrac2 admin]$

--listener.ora監(jiān)聽(tīng)配置文件:
[grid@dbrac2 admin]$ cat listener.ora
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

[grid@dbrac2 admin]$

--sqlnet.ora文件:
[grid@dbrac2 admin]$ cat sqlnet.ora
# sqlnet.ora.dbrac2 Network Configuration File: /oracle/app/11.2.0/grid/network/admin/sqlnet.ora.dbrac2
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

ADR_BASE = /oracle/app/grid

[grid@dbrac2 admin]$


三、檢查集群狀態(tài):
[grid@dbrac2 admin]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.FRA.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.OCRVOTE.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.asm
               ONLINE  ONLINE       dbrac1                   Started             
               ONLINE  ONLINE       dbrac2                   Started             
ora.gsd
               OFFLINE OFFLINE      dbrac1                                       
               OFFLINE OFFLINE      dbrac2                                       
ora.net1.network
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.ons
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       dbrac2                                       
ora.cvu
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac.db
      1        ONLINE  ONLINE       dbrac1                   Open                
      2        ONLINE  ONLINE       dbrac2                   Open                
ora.dbrac1.vip
      1        ONLINE  ONLINE       dbrac1                                       
ora.dbrac2.vip
      1        ONLINE  ONLINE       dbrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       dbrac2                                       
ora.scan1.vip
      1        ONLINE  ONLINE       dbrac2                                       
[grid@dbrac2 admin]$

發(fā)現(xiàn)本地監(jiān)聽(tīng)在ora.LISTENER.lsnr各自online,而scan監(jiān)聽(tīng)ora.LISTENER_SCAN1.lsnr在節(jié)點(diǎn)2上online;

--查看各自監(jiān)聽(tīng)狀態(tài):
節(jié)點(diǎn)2;
[grid@dbrac2 admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2017 14:45:19

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                19-OCT-2017 10:33:22
Uptime                    0 days 4 hr. 11 min. 56 sec
Trace Level               off
Security                  ON: Password or Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/app/grid/diag/tnslsnr/dbrac2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.4)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.5)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "dbrac" has 1 instance(s).
  Instance "dbrac2", status READY, has 1 handler(s) for this service...
Service "dbracXDB" has 1 instance(s).
  Instance "dbrac2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2017 14:45:22

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                18-OCT-2017 22:54:51
Uptime                    0 days 15 hr. 50 min. 31 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/app/11.2.0/grid/log/diag/tnslsnr/dbrac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.8)(PORT=1521)))
Services Summary...
Service "dbrac" has 2 instance(s).
  Instance "dbrac1", status READY, has 1 handler(s) for this service...
  Instance "dbrac2", status READY, has 1 handler(s) for this service...
Service "dbracXDB" has 2 instance(s).
  Instance "dbrac1", status READY, has 1 handler(s) for this service...
  Instance "dbrac2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@dbrac2 admin]$

因?yàn)閟can監(jiān)聽(tīng)駐留在節(jié)點(diǎn)2上。

節(jié)點(diǎn)1:
[grid@dbrac1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2017 14:43:02

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                19-OCT-2017 02:50:38
Uptime                    0 days 11 hr. 52 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/app/grid/diag/tnslsnr/dbrac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.2)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.3)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "dbrac" has 1 instance(s).
  Instance "dbrac1", status READY, has 1 handler(s) for this service...
Service "dbracXDB" has 1 instance(s).
  Instance "dbrac1", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@dbrac1 admin]$
[grid@dbrac1 admin]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2017 14:43:09

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                19-OCT-2017 09:56:13
Uptime                    0 days 4 hr. 46 min. 57 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/app/grid/diag/tnslsnr/dbrac1/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
The listener supports no services
The command completed successfully
[grid@dbrac1 admin]$

local_listener 默認(rèn)不需要配置,默認(rèn)配置指向1521端口,對(duì)于單實(shí)例改變端口需要指向tns里的連接字符串,而在rac配置中默認(rèn)指向本節(jié)點(diǎn)的vip。  
remote_listener指向的是scan監(jiān)聽(tīng)名,需要遠(yuǎn)程監(jiān)聽(tīng)是配置。

Oracle 11.2版本后,有一個(gè)新的監(jiān)聽(tīng)文件endpoints_listener.ora被引進(jìn),里面的內(nèi)容是節(jié)點(diǎn)的IP和VIP信息 。
Endpoints_listener.ora 文件的作用是向后兼容11.2版本以前的數(shù)據(jù)庫(kù),DBCA建庫(kù)時(shí),需要通過(guò)獲取endpoints的位置信息來(lái)配置數(shù)據(jù)庫(kù)參數(shù)和tnsnames,其中最下面兩行參數(shù)涉及ENABLE_GLOBAL_DYNAMIC_ENDPOINT參數(shù),ENABLE_GLOBAL_DYNAMIC_ENDPOINT參數(shù)的作用是允許監(jiān)聽(tīng)程序接受針對(duì)oracle 11.2版本之前未進(jìn)行動(dòng)態(tài)注冊(cè)的連接  

(2)使用srvctl 工具添加監(jiān)聽(tīng)并手動(dòng)加入靜態(tài)注冊(cè)信息
--添加監(jiān)聽(tīng):(在grid用戶下執(zhí)行)
[grid@dbrac2 admin]$ srvctl config network
Network exists: 1/192.168.56.0/255.255.255.0/eth0, type static
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ srvctl add listener -h

Adds a listener configuration to the Oracle Clusterware.

Usage: srvctl add listener [-l ] [-s] [-p "[TCP:][, ...][/IPC:][/NMP:][/TCPS:] [/SDP:]"] [-o ] [-k ]
    -l            Listener name (default name is LISTENER)
    -o          ORACLE_HOME path (default value is CRS_HOME)
    -k              network number (default number is 1)
    -s                       Skip the checking of ports
    -p "[TCP:][, ...][/IPC:][/NMP:][/TCPS:] [/SDP:]"       Comma separated tcp ports or listener endpoints
    -h                       Print usage

-k 填入方才獲得的network number,-p填入端口號(hào),-l填入監(jiān)聽(tīng)名,-o 填入GI HOME路徑

--執(zhí)行:
[grid@dbrac2 admin]$  srvctl add listener -l LISTENER_wang -o $ORACLE_HOME -p 1522 -k 1
[grid@dbrac2 admin]$

--查詢監(jiān)聽(tīng)狀態(tài):
[grid@dbrac2 admin]$ srvctl status listener -h

Displays the current state of the listener.

Usage: srvctl status listener [-l ] [-n ] [-v]
    -l            Listener name
    -n            Node name
    -v                       Verbose output
    -h                       Print usage
[grid@dbrac2 admin]$ srvctl status listener -l LISTENER_wang
Listener LISTENER_WANG is enabled
Listener LISTENER_WANG is not running
[grid@dbrac2 admin]$

--啟動(dòng)監(jiān)聽(tīng):
[grid@dbrac2 admin]$ srvctl start listener -l LISTENER_wang
[grid@dbrac2 admin]$

--查看新建的監(jiān)聽(tīng)狀態(tài):
[grid@dbrac2 admin]$ lsnrctl stauts LISTENER_wang

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2017 15:29:34

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

NL-00853: undefined command "stauts".  Try "help"
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ lsnrctl status LISTENER_wang

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2017 15:29:46

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_WANG)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_WANG
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                19-OCT-2017 15:29:12
Uptime                    0 days 0 hr. 0 min. 35 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/app/11.2.0/grid/log/diag/tnslsnr/dbrac2/listener_wang/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_WANG)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.4)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.5)(PORT=1522)))
The listener supports no services
The command completed successfully
[grid@dbrac2 admin]$

--查看監(jiān)聽(tīng)配置文件:srvctl start listener啟動(dòng)新添加的監(jiān)聽(tīng)后listener.ora和endpoints_listener.ora會(huì)出現(xiàn)新的記錄
[grid@dbrac2 admin]$ ls -lrt
total 32
-rw-r--r-- 1 grid oinstall  381 Oct 16 20:48 shrept.lst
drwxr-xr-x 2 grid oinstall 4096 Oct 16 20:48 samples
-rw-r--r-- 1 grid oinstall  222 Oct 16 21:10 sqlnet.ora
-rw-r--r-- 1 grid oinstall  185 Oct 16 21:10 endpoints_listener.ora.bak.dbrac2
-rw-r--r-- 1 grid oinstall  350 Oct 16 23:33 listener.bak
-rw-r--r-- 1 grid oinstall  481 Oct 19 10:31 listener.ora.bak.dbrac2
-rw-r--r-- 1 grid oinstall  662 Oct 19 15:29 listener.ora
-rw-r--r-- 1 grid oinstall  375 Oct 19 15:29 endpoints_listener.ora
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ cat listener.ora
LISTENER_WANG=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_WANG))))          # 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

#----ADDED BY TNSLSNR 19-OCT-2017 10:31:25---
PASSWORDS_LISTENER = 1DF5C2FD0FE9CFA2
#--------------------------------------------
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_WANG=ON         # line added by Agent
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ cat endpoints_listener.ora
LISTENER_WANG_DBRAC2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dbrac2-vip)(PORT=1522))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.4)(PORT=1522)(IP=FIRST))))# line added by Agent
LISTENER_DBRAC2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dbrac2-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.4)(PORT=1521)(IP=FIRST))))     # line added by Agent
[grid@dbrac2 admin]$ 

--之后僅需要加入靜態(tài)注冊(cè)信息即可,如:
SID_LIST_LISTENER_WANG =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = dbrac)
      (ORACLE_HOME = /oracle/app/11.2.0/grid)
      (SID_NAME=dbrac2)
    )
  )
 
加入如上信息到listener.ora配置文件中(SID_LIST_($LISTENER_NAME),并重啟監(jiān)聽(tīng)即完成靜態(tài)注冊(cè):
[grid@dbrac2 admin]$ srvctl status listener -l LISTENER_WANG
Listener LISTENER_WANG is enabled
Listener LISTENER_WANG is running on node(s): dbrac1,dbrac2
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ srvctl stop listener -l LISTENER_WANG
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ srvctl status listener -l LISTENER_WANG
Listener LISTENER_WANG is enabled
Listener LISTENER_WANG is not running
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ srvctl start listener -l LISTENER_WANG -n dbrac2
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ srvctl status listener -l LISTENER_WANG
Listener LISTENER_WANG is enabled
Listener LISTENER_WANG is running on node(s): dbrac2
命令srvctl start listener -l LISTENER_WANG -n dbrac2只在一個(gè)節(jié)點(diǎn)啟動(dòng)監(jiān)聽(tīng)

--啟動(dòng)監(jiān)聽(tīng)不加參數(shù)默認(rèn)是在兩個(gè)節(jié)點(diǎn)同時(shí)啟動(dòng)
[grid@dbrac2 admin]$ srvctl stop listener -l LISTENER_WANG
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$  srvctl status listener -l LISTENER_WANG
Listener LISTENER_WANG is enabled
Listener LISTENER_WANG is not running
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ srvctl start listener -l LISTENER_WANG -n dbrac1,dbrac2
PRKO-2003 : Invalid command line option value: dbrac1,dbrac2
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ srvctl start listener -l LISTENER_WANG
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$
[grid@dbrac2 admin]$ srvctl status listener -l LISTENER_WANG
Listener LISTENER_WANG is enabled
Listener LISTENER_WANG is running on node(s): dbrac1,dbrac2

--查詢監(jiān)聽(tīng)LISTENER_WANG狀態(tài):
[grid@dbrac2 admin]$ lsnrctl status LISTENER_WANG

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2017 16:08:14

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_WANG)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_WANG
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                19-OCT-2017 16:05:30
Uptime                    0 days 0 hr. 2 min. 43 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/app/11.2.0/grid/log/diag/tnslsnr/dbrac2/listener_wang/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_WANG)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.4)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.5)(PORT=1522)))
Services Summary...
Service "dbrac" has 1 instance(s).
  Instance "dbrac2", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[grid@dbrac2 admin]$

附上節(jié)點(diǎn)一的監(jiān)聽(tīng)配置信息:
[grid@dbrac1 admin]$ cat listener.ora
LISTENER_WANG=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_WANG))))          # 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
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON                # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_WANG=ON         # line added by Agent
[grid@dbrac1 admin]$
[grid@dbrac1 admin]$ cat endpoints_listener.ora
LISTENER_WANG_DBRAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dbrac1-vip)(PORT=1522))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.2)(PORT=1522)(IP=FIRST))))# line added by Agent
LISTENER_DBRAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dbrac1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.2)(PORT=1521)(IP=FIRST))))     # line added by Agent
[grid@dbrac1 admin]$

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“oracle11g rac監(jiān)聽(tīng)配置的示例分析”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI