扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
这篇文章主要介绍了oracle11g rac监听配置的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
创新互联-专业网站定制、快速模板网站建设、高性价比达茂旗网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式达茂旗网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖达茂旗地区。费用合理售后完善,十载实体公司更值得信赖。(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]$
一、查看节点1的oracle、grid用户下的监听及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监听配置文件:
[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]$
二、查看节点2的oracle、grid用户下的监听及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监听配置文件:
[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]$
三、检查集群状态:
[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]$
发现本地监听在ora.LISTENER.lsnr各自online,而scan监听ora.LISTENER_SCAN1.lsnr在节点2上online;
--查看各自监听状态:
节点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]$
因为scan监听驻留在节点2上。
节点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 默认不需要配置,默认配置指向1521端口,对于单实例改变端口需要指向tns里的连接字符串,而在rac配置中默认指向本节点的vip。
remote_listener指向的是scan监听名,需要远程监听是配置。
Oracle 11.2版本后,有一个新的监听文件endpoints_listener.ora被引进,里面的内容是节点的IP和VIP信息 。
Endpoints_listener.ora 文件的作用是向后兼容11.2版本以前的数据库,DBCA建库时,需要通过获取endpoints的位置信息来配置数据库参数和tnsnames,其中最下面两行参数涉及ENABLE_GLOBAL_DYNAMIC_ENDPOINT参数,ENABLE_GLOBAL_DYNAMIC_ENDPOINT参数的作用是允许监听程序接受针对oracle 11.2版本之前未进行动态注册的连接
(2)使用srvctl 工具添加监听并手动加入静态注册信息
--添加监听:(在grid用户下执行)
[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填入端口号,-l填入监听名,-o 填入GI HOME路径
--执行:
[grid@dbrac2 admin]$ srvctl add listener -l LISTENER_wang -o $ORACLE_HOME -p 1522 -k 1
[grid@dbrac2 admin]$
--查询监听状态:
[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]$
--启动监听:
[grid@dbrac2 admin]$ srvctl start listener -l LISTENER_wang
[grid@dbrac2 admin]$
--查看新建的监听状态:
[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]$
--查看监听配置文件:srvctl start listener启动新添加的监听后listener.ora和endpoints_listener.ora会出现新的记录
[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]$
--之后仅需要加入静态注册信息即可,如:
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),并重启监听即完成静态注册:
[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只在一个节点启动监听
--启动监听不加参数默认是在两个节点同时启动
[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
--查询监听LISTENER_WANG状态:
[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]$
附上节点一的监听配置信息:
[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]$
感谢你能够认真阅读完这篇文章,希望小编分享的“oracle11g rac监听配置的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联-成都网站建设公司行业资讯频道,更多相关知识等着你来学习!
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流