当前位置:网站首页>把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(4)—— 修改 oracle11g rac 集群的 scanIP
把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(4)—— 修改 oracle11g rac 集群的 scanIP
2022-06-24 22:54:00 【睿思达DBA_WGX】
把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(4)—— 修改 oracle11g rac 集群的 scanIP
在生产环境中迁移数据时,需要先创建目标数据库集群,数据迁移成功后还需要使用原来的 IP 地址访问 oracle 数据库,这样原来的客户端不需要做任何改变。此时,需要改变目标数据库集群的 scanIP 为源数据库的 IP 地址。
当客户端应用程序使用 scanIP 访问数据库时,scan listener 会将连接转发到 local listener 上。 节点 rac1 的本地监听内容如下:
LISTENER_RAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.101)(PORT=1521)
(IP=FIRST)))) # line added by Agent
一、查看scan ip的状态信息
[[email protected] ~]$ srvctl config scan
SCAN name: rac-scan, Network: 1/192.168.1.0/255.255.255.0/ens34
SCAN VIP name: scan1, IP: /rac-scan/192.168.1.201
二、停止 scan_listener 和 scan
# 停止 scan_listener 和 scan
srvctl stop scan_listener
srvctl stop scan
# ---------------------------------------------------------------------
[[email protected] ~]$ srvctl stop scan_listener
[[email protected] ~]$ srvctl stop scan
# 查看 scan_listener 和 scan 的状态
[[email protected] ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is not running
[[email protected] ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is not running
[[email protected] ~]$ crs_stat -t | grep scan
ora.scan1.vip ora....ip.type OFFLINE OFFLINE
[[email protected] ~]$ crs_stat -t | grep lsnr
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type OFFLINE OFFLINE
ora....C1.lsnr application ONLINE ONLINE rac1
ora....C2.lsnr application ONLINE ONLINE rac2
三、修改 /etc/hosts 文件中的 scanIP(所有节点)
# 切换到 root 用户,节点1 和 节点2 同时修改 scan IP
[[email protected] ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#Public Network (bond1)——公用IP
192.168.1.101 rac1
192.168.1.102 rac2
#Private Interconnect (bond2)——私有IP
10.1.1.101 rac1-priv
10.1.1.102 rac2-priv
#Virtual IP——虚拟 IP,与 bond1 必须在同一网段
192.168.1.111 rac1-vip
192.168.1.112 rac2-vip
#scan IP
192.168.1.221 my-racscan # 原来是:192.168.1.201
四、修改 DNS 服务的配置信息
[[email protected] ~]# vi /var/named/chroot/var/named/1.168.192.local
$TTL 86400
@ IN SOA dns.oracle.com. root.oracle.com. (
19997022700 ; serial
28800 ; refresh
14400 ; retry
3600000 ; expire
86400 ) ; minimum
@ IN NS dns.oracle.com.
101 IN PTR dns.oracle.com.
101 IN PTR rac1.oracle.com.
102 IN PTR rac2.oracle.com.
221 IN PTR scan.oracle.com. # 原来是:201
[[email protected] ~]# vi /var/named/chroot/var/named/oracle.com.zone
$TTL 86400
@ IN SOA dns.oracle.com. root.oracle.com. (
42 ; serial
3H ; refresh
15M ; retry
1W ; expire
1D ) ; minimum
@ IN NS dns.oracle.com.
dns IN A 192.168.1.101
rac1 IN A 192.168.1.101
rac2 IN A 192.168.1.102
scan IN A 192.168.1.221 # 原来是:192.168.1.201
# 重启 named 服务
[[email protected] ~]# systemctl restart named
# 测试
[[email protected] ~]# nslookup 192.168.1.221
Server: 192.168.1.101
Address: 192.168.1.101#53
221.1.168.192.in-addr.arpa name = scan.oracle.com.
[[email protected] ~]# nslookup scan.oracle.com
Server: 192.168.1.101
Address: 192.168.1.101#53
Name: scan.oracle.com
Address: 192.168.1.221
五、修改 SCAN 名称
# 切换到 root 用户
[[email protected] ~]# cd /u01/app/11.2.0/grid/bin
[[email protected] bin]# pwd
/u01/app/11.2.0/grid/bin
[[email protected] bin]# ./srvctl modify scan -n my-racscan
# 查看scan ip 的状态信息
[[email protected] bin]# ./srvctl config scan
SCAN 名称: my-racscan, 网络: 1/192.168.1.0/255.255.255.0/ens34
SCAN VIP 名称: scan1, IP: /my-racscan/192.168.1.221
六、启动 scan 和 scan_listener
# 启动 scan 和 scan_listener
[[email protected] admin]$ srvctl start scan
[[email protected] admin]$ srvctl start scan_listener
# 查看 scan 和 scan_listener 的状态:
[[email protected] admin]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node rac1
[[email protected] admin]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node rac1
[[email protected] admin]$ crs_stat -t | grep scan
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
[[email protected] admin]$ crs_stat -t | grep lsnr
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora....C2.lsnr application ONLINE ONLINE rac2
七、测试:使用新的 scanIP 访问数据库
1、测试新的 scanIP 是否能够使用
[[email protected] ~]$ ping 192.168.1.221
PING 192.168.1.221 (192.168.1.221) 56(84) bytes of data.
64 bytes from 192.168.1.221: icmp_seq=1 ttl=64 time=2.84 ms
64 bytes from 192.168.1.221: icmp_seq=2 ttl=64 time=0.267 ms
64 bytes from 192.168.1.221: icmp_seq=3 ttl=64 time=14.3 ms
^C
--- 192.168.1.221 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.267/5.827/14.374/6.134 ms
2、使用新的 scanIP 访问数据库
[oracle@rac1 ~]$ sqlplus sys/oracle@192.168.1.221/hisdb as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jun 19 10:24:11 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
-- 出现错误,错误码:ORA-12514
八、解决 ORA-12514 错误
1、在节点 rac1 执行如下操作
-- 查看参数:remote_listener
SQL> show parameter remote_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_listener string
-- 修改参数 remote_listener 的值为空
SQL> alter system set remote_listener='';
System altered.
-- 注册
SQL> alter system register;
System altered.
-- 修改参数 remote_listener 的值
SQL> alter system set remote_listener='my-racscan:1521';
System altered.
-- 查看参数:remote_listener
SQL> show parameter remote_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_listener string my-racscan:1521
2、测试:使用新的 scanIP 访问数据库
[[email protected] ~]$ sqlplus sys/[email protected]/hisdb as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 22 13:57:47 2022
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>
边栏推荐
- 如何卸载cuda
- 进入阿里做测试员遥不可及?这里或许有你想要的答案
- Constant current circuit composed of 2 NPN triodes
- 【FPGA】串口以命令控制温度采集
- Intégration de la plate - forme de test continu open source de metersphere avec Alibaba Cloud Effect devops
- 左手梦想 右手责任 广汽本田不光关注销量 还有儿童安全
- Sumati GameFi生态纵览,神奇世界中的元素设计
- Please run IDA with elevated permissons for local debugging.
- Application of TSDB in civil aircraft industry
- 谈谈飞书对开发工作的优势 | 社区征文
猜你喜欢

The role of software security testing, how to find a software security testing company to issue a report?

How to monitor the log through the easycvr interface to observe the platform streaming?

做软件安全测试的作用,如何寻找软件安全测试公司出具报告?

入坑机器学习:一,绪论

3 years of testing experience. I don't even understand what I really need on my resume. I need 20K to open my mouth?

左手梦想 右手责任 广汽本田不光关注销量 还有儿童安全

进入阿里做测试员遥不可及?这里或许有你想要的答案

ProcessOn制作ER过程(自定义)

罗德与施瓦茨与中关村泛联院合作开展6G技术研究与早期验证

Redis
随机推荐
FTP协议讲解
Is the compass reliable? Is it safe to open a securities account?
左手梦想 右手责任 广汽本田不光关注销量 还有儿童安全
Software testing salary in first tier cities - are you dragging your feet
进入阿里做测试员遥不可及?这里或许有你想要的答案
多模态情感识别_多模态融合的情感识别研究「建议收藏」
Redis 那些事
2022年云计算应用关键威胁调查
Multimodal emotion recognition_ Research on emotion recognition based on multimodal fusion
探索C语言程序奥秘——C语言程序编译与预处理
入坑机器学习:一,绪论
Sumati GameFi生态纵览,神奇世界中的元素设计
折叠屏将成国产手机分食苹果市场的重要武器
Test / development programmers, 30, do you feel confused? And where to go
Experience of epidemic prevention and control, home office and online teaching | community essay solicitation
How to monitor the log through the easycvr interface to observe the platform streaming?
3年测试经验,连简历上真正需要什么都没搞明白,张口就要20k?
2022-06-24:golang选择题,以下golang代码输出什么?A:1;B:3;C:4;D:编译失败。 package main import ( “f
华为、阿里等大厂程序员真的好找对象吗?
转行软件测试2年了,给还在犹豫的女生一点建议