11g rac監聽配置解析
參考:
(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]$
(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]$
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31444259/viewspace-2151845/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11g RAC 監聽日常管理Oracle
- oracle 11g tns和監聽配置Oracle
- Oracle 10g RAC客戶端配置監聽Oracle 10g客戶端
- rac監聽動態註冊
- Oracle 11g/12c 監聽器白名單的配置Oracle
- oracle 監聽器配置Oracle
- 監聽配置詳解
- Oracle 11g 修改監聽埠Oracle
- oracle 11g 監聽檔案Oracle
- 同時配置動態監聽與靜態監聽
- 12C RAC 修改監聽埠
- rac監聽不能動態註冊
- oracle rac scan監聽更改埠號Oracle
- 一次RAC監聽停止分析
- rac的vip和監聽莫名故障
- Oracle 監聽配置詳解Oracle
- Oracle 動態監聽配置Oracle
- Oracle 監聽器日誌解析Oracle
- Oracle RAC Database 11.1.0.6監聽故障案例OracleDatabase
- 【RAC】lsnrctl 工具不適合管理監聽
- 2.5.2. 監聽程式(listener)配置——2.5.2.3. 手工編輯監聽器配置檔案
- oracle 監聽配置多個埠Oracle
- OEL6下靜默安裝Oracle 11g,靜默配置監聽Oracle
- 模型deleted事件監聽報錯解析模型delete事件
- Oracle 監聽器日誌解析(續)Oracle
- Oracle 11g 檢視監聽日誌Oracle
- Oracle 11g 監聽相關檔案Oracle
- rac scan listener log 清理監聽日誌 oracleOracle
- rac中解除安裝監聽lsnr和asmASM
- RAC 監聽中的 IP=FIRST 是啥意思?
- oracle 10g rac當監聽程式監聽對方vip時啟動監聽報錯TNS-12545Oracle 10g
- 【RAC】刪除RAC資料庫節點(三)——刪除監聽資料庫
- 【監聽】配置服務端靜態(動態)監聽/修改監聽埠及引數local_listener作用服務端
- 配置資料庫監聽白名單資料庫
- ASM例項配置監聽和TNSASM
- 伺服器端監聽器配置伺服器
- oracle rac的scan監聽狀態Not All Endpoints RegisteredOracle
- ORACLE 11g RAC EM手動配置Oracle