最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Oracle 12.1 RAC 配置第二个网络和相应的SCAN2例子
时间:2022-06-29 09:44:05 编辑:袖梨 来源:一聚教程网
在配置ADG或者使用oracle 的集群管理应用的HA时(比如OGG),我们可能希望使用不同的网络,以避免ADG传输日志等对主生产网络的造成影响。
从11.2开始,我们可以使用crs管理多个网络资源(缺省只有network1),但是SCAN只能在多个网络中的一个上活动(缺省是network1,后续可以指定到不同网络上)。
然后,我们通常会配置专门为ADG传输日志的network2网络,但是在配置连接串时,只能使用vip(因为SCAN通常给主生产上的network1使用)。
.
从12.1开始,我们可以配置多个网络上的多个SCAN,比如我们配置ADG时,在network2上配置SCAN2。
具体配置如下:
–检查网卡接口对应的IP地址:
[root@rac1 ~]# ifconfig | egrep 'eth0' -A 1 | grep 'inet ' | cut -d : -f2 | cut -d ' ' -f1
192.168.56.61
192.168.56.63
[root@rac1 ~]# ifconfig | egrep 'eth2' -A 1 | grep 'inet ' | cut -d : -f2 | cut -d ' ' -f1
192.168.209.61
[root@rac1 ~]#
[root@rac2 ~]# ifconfig | egrep 'eth0' -A 1 | grep 'inet ' | cut -d : -f2 | cut -d ' ' -f1
192.168.56.62
192.168.56.64
192.168.56.65
[root@rac2 ~]# ifconfig | egrep 'eth2' -A 1 | grep 'inet ' | cut -d : -f2 | cut -d ' ' -f1
192.168.209.62
[root@rac2 ~]#
–添加新的public网络
[grid@rac1 ~]$ oifcfg getif
eth0 192.168.56.0 global public
eth1 192.168.60.0 global cluster_interconnect
[grid@rac1 ~]$
[grid@rac1 ~]$ oifcfg setif -global eth2/192.168.209.0:public
[grid@rac1 ~]$ oifcfg getif
eth0 192.168.56.0 global public
eth1 192.168.60.0 global cluster_interconnect
eth2 192.168.209.0 global public
[grid@rac1 ~]$
–检查网络定义,缺省只有一个网络定义:network1
[grid@rac1 ~]$ srvctl config network
Network 1 exists
Subnet IPv4: 192.168.56.0/255.255.255.0/eth0, static
Subnet IPv6:
Ping Targets:
Network is enabled
Network is individually enabled on nodes:
Network is individually disabled on nodes:
[grid@rac1 ~]$
–添加新的网络集群资源(a new network cluster resource)
[root@rac1 ~]# ipcalc -bnm 192.168.209.61 255.255.255.0
NETMASK=255.255.255.0
BROADCAST=192.168.209.255
NETWORK=192.168.209.0
[root@rac1 ~]#
[root@rac1 ~]# srvctl add network -netnum 2 -subnet 192.168.209.0/255.255.255.0/eth2
[root@rac1 ~]#
[root@rac1 ~]# srvctl config network
Network 1 exists
Subnet IPv4: 192.168.56.0/255.255.255.0/eth0, static
Subnet IPv6:
Ping Targets:
Network is enabled
Network is individually enabled on nodes:
Network is individually disabled on nodes:
Network 2 exists
Subnet IPv4: 192.168.209.0/255.255.255.0/eth2, static
Subnet IPv6:
Ping Targets:
Network is enabled
Network is individually enabled on nodes:
Network is individually disabled on nodes:
[root@rac1 ~]#
这时集群的网络资源中已经配置了两个网络(包括新增加的网络),如果使用“crsctl status res -t”查看,可以看到:
[root@rac1 ~]# crsctl status res -t |grep -A 2 network
ora.net1.network
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.net2.network
OFFLINE OFFLINE rac1 STABLE
OFFLINE OFFLINE rac2 STABLE
[root@rac1 ~]#
–添加vip
[root@rac1 ~]# srvctl add vip -node rac1 -netnum 2 -address rac1-adg-vip/255.255.255.0/eth2
[root@rac1 ~]# srvctl add vip -node rac2 -netnum 2 -address rac2-adg-vip/255.255.255.0/eth2
[root@rac1 ~]# srvctl config vip -n rac1
VIP exists: network number 1, hosting node rac1
VIP Name: rac1-vip
VIP IPv4 Address: 192.168.56.63
VIP IPv6 Address:
VIP is enabled.
VIP is individually enabled on nodes:
VIP is individually disabled on nodes:
VIP exists: network number 2, hosting node rac1
VIP Name: rac1-adg-vip
VIP IPv4 Address: 192.168.209.63
VIP IPv6 Address:
VIP is enabled.
VIP is individually enabled on nodes:
VIP is individually disabled on nodes:
[root@rac1 ~]# srvctl config vip -n rac2
VIP exists: network number 1, hosting node rac2
VIP Name: rac2-vip
VIP IPv4 Address: 192.168.56.64
VIP IPv6 Address:
VIP is enabled.
VIP is individually enabled on nodes:
VIP is individually disabled on nodes:
VIP exists: network number 2, hosting node rac2
VIP Name: rac2-adg-vip
VIP IPv4 Address: 192.168.209.64
VIP IPv6 Address:
VIP is enabled.
VIP is individually enabled on nodes:
VIP is individually disabled on nodes:
[root@rac1 ~]# crsctl status res -t |grep -A 2 network
ora.net1.network
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.net2.network
OFFLINE OFFLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
[root@rac1 ~]# crsctl status res -t |grep -A 2 vip
ora.rac1.vip
1 ONLINE ONLINE rac1 STABLE
ora.rac1_2.vip
1 OFFLINE OFFLINE STABLE
ora.rac2.vip
1 ONLINE ONLINE rac2 STABLE
ora.rac2_2.vip
1 OFFLINE OFFLINE STABLE
ora.scan1.vip
1 ONLINE ONLINE rac2 STABLE
--------------------------------------------------------------------------------
[root@rac1 ~]#
–启动vip,查看vip资源
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ srvctl start vip -vip rac1-adg-vip
[grid@rac1 ~]$ srvctl start vip -vip rac2-adg-vip
[grid@rac1 ~]$ srvctl status vip -n rac1
VIP rac1-vip is enabled
VIP rac1-vip is running on node: rac1
VIP rac1-adg-vip is enabled
VIP rac1-adg-vip is running on node: rac1
[grid@rac1 ~]$ srvctl status vip -n rac2
VIP rac2-vip is enabled
VIP rac2-vip is running on node: rac2
VIP rac2-adg-vip is enabled
VIP rac2-adg-vip is running on node: rac2
[grid@rac1 ~]$
[grid@rac1 ~]$ crsctl status res -t |grep -A 2 network
ora.net1.network
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.net2.network
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
[grid@rac1 ~]$ crsctl status res -t |grep -A 2 vip
ora.rac1.vip
1 ONLINE ONLINE rac1 STABLE
ora.rac1_2.vip
1 ONLINE ONLINE rac1 STABLE
ora.rac2.vip
1 ONLINE ONLINE rac2 STABLE
ora.rac2_2.vip
1 ONLINE ONLINE rac2 STABLE
ora.scan1.vip
1 ONLINE ONLINE rac2 STABLE
--------------------------------------------------------------------------------
[grid@rac1 ~]$
–检查新创建的vip是否运行了:
[grid@rac1 ~]$ /sbin/ifconfig eth2:1
eth2:1 Link encap:Ethernet HWaddr 08:00:27:17:79:3C
inet addr:192.168.209.63 Bcast:192.168.209.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
[grid@rac1 ~]$
[root@rac2 ~]# /sbin/ifconfig eth2:1
eth2:1 Link encap:Ethernet HWaddr 08:00:27:74:C7:94
inet addr:192.168.209.64 Bcast:192.168.209.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
[root@rac2 ~]#
–添加网络2上的监听:
[grid@rac1 ~]$ srvctl add listener -listener LISTENER_ADG -netnum 2 -endpoints "TCP:1522"
[grid@rac1 ~]$ crsctl status res -t |grep -A 2 LISTENER
ora.LISTENER.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.LISTENER_ADG.lsnr
OFFLINE OFFLINE rac1 STABLE
OFFLINE OFFLINE rac2 STABLE
--
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.MGMTLSNR
[grid@rac1 ~]$
在network2上配置SCAN:
[root@rac1 ~]# srvctl add scan -scanname racadg-scan -netnum 2
[root@rac1 ~]# srvctl config scan -netnum 2
SCAN name: racadg-scan, Network: 2
Subnet IPv4: 192.168.209.0/255.255.255.0/eth2, static
Subnet IPv6:
SCAN 0 IPv4 VIP: 192.168.209.65
SCAN VIP is enabled.
SCAN VIP is individually enabled on nodes:
SCAN VIP is individually disabled on nodes:
[root@rac1 ~]# srvctl status scan -netnum 2
SCAN VIP scan1_net2 is enabled
SCAN VIP scan1_net2 is not running
[root@rac1 ~]# crsctl status res -t |grep -A 2 LISTENER
ora.LISTENER.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.LISTENER_ADG.lsnr
OFFLINE OFFLINE rac1 STABLE
OFFLINE OFFLINE rac2 STABLE
--
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.MGMTLSNR
[root@rac1 ~]# crsctl status res -t |grep -A 1 SCAN
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
[root@rac1 ~]#
–启动network2上的监听
[grid@rac1 ~]$ srvctl start listener -listener LISTENER_ADG
[grid@rac1 ~]$ srvctl status listener -listener LISTENER_ADG
Listener LISTENER_ADG is enabled
Listener LISTENER_ADG is running on node(s): rac1,rac2
[grid@rac1 ~]$ srvctl status listener -listener LISTENER
Listener LISTENER is enabled
Listener LISTENER is running on node(s): rac1,rac2
[grid@rac1 ~]$
[grid@rac1 ~]$ crsctl status res -t |grep -A 2 LISTENER
ora.LISTENER.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.LISTENER_ADG.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
--
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.MGMTLSNR
[grid@rac1 ~]$ crsctl status res -t |grep -A 2 SCAN
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.MGMTLSNR
[grid@rac1 ~]$
–在network2上启动SCAN
[root@rac1 ~]# srvctl start scan -netnum 2
[root@rac1 ~]# srvctl config scan -netnum 2
SCAN name: racadg-scan, Network: 2
Subnet IPv4: 192.168.209.0/255.255.255.0/eth2, static
Subnet IPv6:
SCAN 0 IPv4 VIP: 192.168.209.65
SCAN VIP is enabled.
SCAN VIP is individually enabled on nodes:
SCAN VIP is individually disabled on nodes:
[root@rac1 ~]# srvctl status scan -netnum 2
SCAN VIP scan1_net2 is enabled
SCAN VIP scan1_net2 is running on node rac1
[root@rac1 ~]# crsctl status res -t |grep -A 2 LISTENER
ora.LISTENER.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.LISTENER_ADG.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
--
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.MGMTLSNR
[root@rac1 ~]# crsctl status res -t |grep -A 2 SCAN
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.MGMTLSNR
[root@rac1 ~]#
–在network2上添加SCAN LISTENER
[grid@rac1 ~]$ srvctl add scan_listener -netnum 2 -listener racadg-scanlsnr -endpoints "TCP:1522"
[grid@rac1 ~]$ srvctl start scan_listener -netnum 2
[grid@rac1 ~]$ srvctl status scan_listener -netnum 2
SCAN Listener RACADG-SCANLSNR_SCAN1_NET2 is enabled
SCAN listener RACADG-SCANLSNR_SCAN1_NET2 is running on node rac1
[grid@rac1 ~]$ srvctl config scan_listener -netnum 2
SCAN Listener RACADG-SCANLSNR_SCAN1_NET2 exists. Port: TCP:1522
Registration invited nodes:
Registration invited subnets:
SCAN Listener is enabled.
SCAN Listener is individually enabled on nodes:
SCAN Listener is individually disabled on nodes:
[grid@rac1 ~]$ crsctl status res -t |grep -A 2 LISTENER
ora.LISTENER.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.LISTENER_ADG.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
--
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.MGMTLSNR
[grid@rac1 ~]$ crsctl status res -t |grep -A 2 SCAN
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.MGMTLSNR
--
ora.RACADG-SCANLSNR_SCAN1_NET2.lsnr
1 ONLINE ONLINE rac1 STABLE
ora.cvu
[grid@rac1 ~]$
–检查监听状态
[grid@rac1 ~]$ netstat -an |grep 1521|grep LISTEN
tcp 0 0 169.254.242.79:1521 0.0.0.0:* LISTEN
tcp 0 0 192.168.60.61:1521 0.0.0.0:* LISTEN -----rac1-priv
tcp 0 0 192.168.56.63:1521 0.0.0.0:* LISTEN -----rac1-vip
tcp 0 0 192.168.56.61:1521 0.0.0.0:* LISTEN -----rac1
[grid@rac1 ~]$ netstat -an |grep 1522|grep LISTEN
tcp 0 0 192.168.209.65:1522 0.0.0.0:* LISTEN -----rac-scan
tcp 0 0 192.168.209.63:1522 0.0.0.0:* LISTEN -----rac1-adg-vip
[grid@rac1 ~]$ lsnrctl status LISTENER
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 16-FEB-2016 21:41:54
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 16-FEB-2016 17:59:39
Uptime 0 days 3 hr. 42 min. 14 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/12.1.0.2/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.61)(PORT=1521))) -----rac1
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.63)(PORT=1521))) -----rac1-vip
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=rac1)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.1.0.2/dbhome_1/admin/lunar/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "lunar" has 1 instance(s).
Instance "lunar1", status READY, has 1 handler(s) for this service...
Service "lunarXDB" has 1 instance(s).
Instance "lunar1", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@rac1 ~]$
[grid@rac1 ~]$ lsnrctl status LISTENER_ADG
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 16-FEB-2016 21:41:59
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_ADG)))
STATUS of the LISTENER
------------------------
Alias LISTENER_ADG
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 16-FEB-2016 21:13:48
Uptime 0 days 0 hr. 28 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/12.1.0.2/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/rac1/listener_adg/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_ADG)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.209.63)(PORT=1522)))
The listener supports no services
The command completed successfully
[grid@rac1 ~]$
配置ORACLE数据库实例支持多个网络:
LUNARRAC1_LOCAL_NET1 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521)))
LUNARRAC1_LOCAL_NET2 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-adg-vip)(PORT = 1522)))
LUNARRAC2_LOCAL_NET1 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521)))
LUNARRAC2_LOCAL_NET2 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-adg-vip)(PORT = 1522)))
LUNARRAC_REMOTE_NET1 =(DESCRIPTION_LIST =(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))))
LUNARRAC_REMOTE_NET2 =(DESCRIPTION_LIST =(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = racadg-scan)(PORT = 1522))))
[oracle@rac1 admin]$ ss
SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 18 21:58:50 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SYS@lunar1>
SYS@lunar1>alter system set listener_networks='((NAME=network1)(LOCAL_LISTENER=LUNARRAC1_LOCAL_NET1)(REMOTE_LISTENER=LUNARRAC_REMOTE_NET1))','((NAME=network2)(LOCAL_LISTENER=LUNARRAC1_LOCAL_NET2)(REMOTE_LISTENER=LUNARRAC_REMOTE_NET2))' sid='lunar1';
System altered.
Elapsed: 00:00:00.36
SYS@lunar1>alter system set listener_networks='((NAME=network1)(LOCAL_LISTENER=LUNARRAC2_LOCAL_NET1)(REMOTE_LISTENER=LUNARRAC_REMOTE_NET1))','((NAME=network2)(LOCAL_LISTENER=LUNARRAC2_LOCAL_NET2)(REMOTE_LISTENER=LUNARRAC_REMOTE_NET2))' sid='lunar2';
System altered.
Elapsed: 00:00:00.19
SYS@lunar1>alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip)(PORT=1521))))' sid='lunar1';
System altered.
Elapsed: 00:00:00.03
SYS@lunar1>alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip)(PORT=1521))))' sid='lunar2';
System altered.
Elapsed: 00:00:00.80
SYS@lunar1>
配置客户端连接串
—检查数据库是否可以登录:
[oracle@lunarrac ~]$ ss
SQL*Plus: Release 12.1.0.2.0 Production on Fri Feb 19 08:57:30 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SYS@lunar1>conn sys/oracle@//lunarrac-scan:1521/lunar as sysdba
Connected.
SYS@//lunarrac-scan:1521/lunar>conn sys/oracle@//lunaradg-scan:1522/lunar as sysdba
Connected.
SYS@//lunaradg-scan:1522/lunar>conn system/oracle@//lunarrac-scan:1521/lunar
Connected.
SYSTEM@//lunarrac-scan:1521/lunar>conn system/oracle@//lunaradg-scan:1522/lunar
Connected.
SYSTEM@//lunaradg-scan:1522/lunar>conn sys/[email protected] as sysdba
Connected.
[email protected]>conn sys/[email protected] as sysdba
Connected.
[email protected]>conn sys/[email protected] as sysdba
Connected.
[email protected]>conn sys/[email protected] as sysdba
Connected.
[email protected]>conn sys/oracle@rac1adg as sysdba
Connected.
SYS@rac1adg>conn sys/oracle@rac2adg as sysdba
Connected.
SYS@rac2adg>conn sys/[email protected] as sysdba
Connected.
[email protected]>conn sys/[email protected] as sysdba
Connected.
[email protected]>conn sys/oracle@rac1 as sysdba
Connected.
SYS@rac1>conn sys/oracle@rac2 as sysdba
Connected.
SYS@rac2>conn sys/[email protected] as sysdba
Connected.
[email protected]>conn sys/[email protected] as sysdba
Connected.
[email protected]>
至此已经全部完成。
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20