原數(shù)據(jù)庫(kù)主機(jī)維保到期,需要做數(shù)據(jù)庫(kù)遷移,制定的最終遷移方案是新搭建一套rac成為原庫(kù)的ADG備庫(kù),割接當(dāng)晚做主備切換,為了讓業(yè)務(wù)側(cè)改動(dòng)最小化,切換完以后做主備IP替換操作,按照生產(chǎn)環(huán)境db_unique_name添加注冊(cè)service_names,確保業(yè)務(wù)側(cè)幾乎零改動(dòng)。
檢查兩節(jié)點(diǎn)啟動(dòng)情況 srvctl status instance -d TESTDB -i TESTDB1,TESTDB2 停止二節(jié)點(diǎn)實(shí)例 srvctl stop instance -d TESTDB -i TESTDB2 |
(1)主庫(kù)查詢(xún): SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE; SWITCHOVER_STATUS -------------------- SESSIONS ACTIVE (2)TO STANDBY或者SESSIONS ACTIVE狀態(tài)下,主庫(kù)可以切換成備庫(kù)角色 ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN; srvctl stop database -d TESTDB srvctl start database -d TESTDB -o mount |
(1)TO PRIMARY或者SESSIONS ACTIVE 狀態(tài)說(shuō)明備庫(kù)已經(jīng)準(zhǔn)備好切換成主庫(kù)角色 SELECT SWITCHOVER_STATUS FROM V$DATABASE; SWITCHOVER_STATUS -------------------- TO PRIMARY 切換目標(biāo)RAC物理備庫(kù)成為主庫(kù) ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN; 節(jié)點(diǎn)一執(zhí)行: 查看數(shù)據(jù)庫(kù)狀態(tài)是否是mount select open_mode from v$database; ALTER DATABASE OPEN; 節(jié)點(diǎn)二執(zhí)行: 查看數(shù)據(jù)庫(kù)狀態(tài)是否是mount select open_mode from v$database; ALTER DATABASE OPEN; |
(1)啟動(dòng)日志應(yīng)用被激活備庫(kù): ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION; (2)啟動(dòng)新備庫(kù)到open alter database recover managed standby database cancel; alter database open; alter database recover managed standby database using current logfile disconnect from session; |
(1)alter日志檢查: Tail -100f $ORACLE_BASE/rdbms/TEST/TESTDB1/alert/log.xml (2) 查看主備應(yīng)用狀態(tài) set linesize 200 column name format a22 column value format a16 column unit format a28 column time_computed format a25 select * from v$dataguard_stats; |
基礎(chǔ)環(huán)境
主庫(kù) | 備庫(kù) | |
IP地址規(guī)劃 cat /etc/hosts | 192.168.0.21 testdb1 testdb1.com 192.168.0.23 testdb1-vip 192.168.0.22 testdb2 testdb2.com 192.168.0.24 testdb2-vip 192.168.0.25 testdb-cluster testdb-cluster-scan 192.168.0.121 testdb1-priv 192.168.0.122 testdb2-priv | 192.168.0.245 testdb1 testdb1.com 192.168.0.247 testdb1-vip 192.168.0.246 testdb2 testdb2.com 192.168.0.248 testdb2-vip 192.168.0.251 testdb-cluster testdb-cluster-scan 192.168.99.121 testdb1-priv 192.168.99.122 testdb2-priv |
替換后IP地址規(guī)劃 | 192.168.0.245 testdb1 testdb1.com 192.168.0.247 testdb1-vip 192.168.0.246 testdb2 testdb2.com 192.168.0.248 testdb2-vip 192.168.0.251 testdb-cluster testdb-cluster-scan 192.168.0.121 testdb1-priv 192.168.0.122 testdb2-priv | 192.168.0.21 testdb1 testdb1.com 192.168.0.23 testdb1-vip 192.168.0.22 testdb2 testdb2.com 192.168.0.24 testdb2-vip 192.168.0.25 testdb-cluster testdb-cluster-scan 192.168.99.121 testdb1-priv 192.168.99.122 testdb2-priv |
db_name | TESTDB | TESTDB |
db_unique_name | TESTDB | TESTDB _NEW |
Instance_name | TESTDB1 TESTDB2 | TESTDB1 TESTDB2 |
主備環(huán)境處理私有IP不替換意外,公網(wǎng)ip,虛ip,scan_ip都需要替換 1:提前準(zhǔn)備好需要替換的hosts->hosts_bak(替換后的新hosts 信息) 2:提前準(zhǔn)備好tnsnames.ora->qiehuan_tnsnames.ora(ip互換以后新的tnsnames信息) 3:提前申請(qǐng)兩個(gè)IP 4:由于私網(wǎng)IP不做替換,所以沒(méi)有停集群的必要 |
停止日志應(yīng)用: alter database recover managed standby database cancel; |
(1)root下執(zhí)行 cd $GRID_HOME/bin ./srvctl stop database -d testdb ./srvctl disable database -d testdb (2) 禁用和停止listener: ./srvctl disable listener ./srvctl stop listener (3) 禁用和停止vip ./srvctl disable vip -i "test1-vip" ./srvctl disable vip -i "test2-vip" ./srvctl stop vip -n test1 ./srvctl stop vip -n test2 (4) 禁用和停止scan及scan_listener ./srvctl disable scan_listener ./srvctl stop scan_listener ./srvctl disable scan ./srvctl stop scan (5)停crs 兩節(jié)點(diǎn)執(zhí)行(因?yàn)榇朔N變更肯定有停機(jī)窗口,建議停止集群) ./crsctl stop crs |
(1)修改網(wǎng)卡ip成備用ip#192.168.0.232 《=》 21 #192.168.0.233 《=》22 192.168.0.21: vi /etc/sysconfig/network-scripts/ifcfg-bond0 IPADDR=192.168.0.21->IPADDR=192.168.0.232 192.168.0.22: vi /etc/sysconfig/network-scripts/ifcfg-bond0 IPADDR=192.168.0.22->IPADDR=192.168.0.233 (2):重啟網(wǎng)卡重啟整個(gè)網(wǎng)絡(luò):192.168.0.21 192.168.0.22 兩節(jié)點(diǎn)執(zhí)行 nohup /etc/init.d/network restart & |
(1)停止備庫(kù)兩節(jié)點(diǎn)實(shí)例并禁止自啟動(dòng) cd $GRID_HOME/bin ./srvctl stop database -d testdb ./srvctl disable database -d testdb (2)禁用和停止listener ./srvctl disable listener ./srvctl stop listener (3)禁用和停止vip ./srvctl disable vip -i "test1-vip" ./srvctl disable vip -i "test2-vip" ./srvctl stop vip -n test1 ./srvctl stop vip -n test2 (4)禁用和停止scan及scan_listener ./srvctl disable scan_listener ./srvctl stop scan_listener ./srvctl disable scan ./srvctl stop scan (5)在所有節(jié)點(diǎn)停止CRS服務(wù) ./crsctl stop crs (6) 修改網(wǎng)卡ip重啟整個(gè)網(wǎng)絡(luò) 192.168.0.245: vi /etc/sysconfig/network-scripts/ifcfg-bond0 IPADDR=192.168.0.245 -> IPADDR=192.168.0.21 192.168.0.246: vi /etc/sysconfig/network-scripts/ifcfg-bond0 IPADDR=192.168.0.246 -> IPADDR=192.168.0.22 nohup /etc/init.d/network restart & 重啟網(wǎng)絡(luò)后登陸ip將不再是 245,246 ,需要登陸新的ip 245-21 246-22 3.8 修改/etc/hosts 登陸新的兩節(jié)點(diǎn):21 22 (可以通過(guò)test1-priv網(wǎng)判斷192.168.99.121,192.168.99.122為待修改主庫(kù)ip) cd /etc/ cp hosts hosts_bak mv zzj_hosts hosts |
(1)重啟crs服務(wù)(同網(wǎng)段IP修改,public是設(shè)置網(wǎng)段,所以不需要處理,只需要處理VIP,scanIP) #兩節(jié)點(diǎn)執(zhí)行: cd /g01/11ggrid/app/11.2.0/grid/bin ./crsctl start crs #啟動(dòng)時(shí)可以查看啟動(dòng)進(jìn)度,一般五分鐘可以啟動(dòng)完 #ps -ef | grep d.bin (2)查看并重新配置vip ./srvctl config vip -n test1 ./srvctl config vip -n test2 ./srvctl modify nodeapps -A 192.168.0.23/255.255.255.0/bond0 -n test1 ./srvctl modify nodeapps -A 192.168.0.24/255.255.255.0/bond0 -n test2 ./srvctl config vip -n test1 ./srvctl config vip -n test2 (3)查看并重新配置SCAN ./srvctl config scan ./srvctl modify scan -n test-cluster-scan ./srvctl config scan (4)配置完成,啟動(dòng)相關(guān)的服務(wù)和resource ./srvctl enable listener ./srvctl enable vip -i "test1-vip" ./srvctl enable vip -i "test2-vip" ./srvctl enable scan_listener ./srvctl enable scan ./srvctl enable database -d testdb ./srvctl start listener ./srvctl start vip -n test1 ./srvctl start vip -n test2 ./srvctl start scan_listener ./srvctl start scan ./srvctl start database -d testdb (5) 檢查集群狀態(tài) ./crsctl status res -t |
7、替換老racIP信息
1)修改ifcfg-bond0重啟網(wǎng)絡(luò) #192.168.0.232 vi /etc/sysconfig/network-scripts/ifcfg-bond0 IPADDR=192.168.0.232->IPADDR=192.168.0.245 #192.168.0.233 vi /etc/sysconfig/network-scripts/ifcfg-bond0 IPADDR=192.168.0.233->IPADDR=192.168.0.246 nohup /etc/init.d/network restart & 2) 重新登陸192.168.0.245,192.168.0.246(通過(guò)私有ip 192.168.0.121,192.168.0.122判斷為原來(lái)的21,22) cd /etc/ cp hosts hosts_bak mv zzj_hosts hosts 3)重啟crs服務(wù)兩節(jié)點(diǎn)root操作 cd #兩節(jié)點(diǎn)執(zhí)行: cd $GRID_HOME/bin ./crsctl start crs #啟動(dòng)時(shí)可以查看啟動(dòng)進(jìn)度,一般五分鐘可以啟動(dòng)完 #ps -ef | grep d.bin 4) 通過(guò)oifcfg 工具修改ip #在不調(diào)整ip網(wǎng)段的情況下此步驟可忽略 查看配置信息 ./oifcfg iflist ./oifcfg iflist -p ./oifcfg iflist -p -n ./oifcfg getif -global 刪除原來(lái)的網(wǎng)卡ip 配置信息 ./oifcfg delif -global bond0 ./oifcfg getif ./oifcfg getif -global 重新配置網(wǎng)卡ip信息 ./oifcfg setif -global bond0/192.168.0.0:public ./oifcfg getif ./oifcfg iflist ./oifcfg iflist -p -n 5)查看并重新配置vip ./srvctl config vip -n test1 ./srvctl config vip -n test2 ./srvctl modify nodeapps -A 192.168.0.247/255.255.255.0/bond0 -n test1 ./srvctl modify nodeapps -A 192.168.0.248/255.255.255.0/bond0 –n test2 ./srvctl config vip -n test1 ./srvctl config vip -n test2 6)查看并重新配置SCAN ./srvctl config scan ./srvctl modify scan -n test-cluster-scan ./srvctl config scan 7)配置完成,啟動(dòng)相關(guān)的服務(wù)和resource ./srvctl enable listener ./srvctl enable vip -i "test1-vip" ./srvctl enable vip -i "test2-vip" ./srvctl enable scan_listener ./srvctl enable scan ./srvctl enable database -d testdb ./srvctl start listener ./srvctl start vip -n test1 ./srvctl start vip -n test2 ./srvctl start scan_listener ./srvctl start scan ./srvctl start database -d testdb 8)檢查集群狀態(tài) ./crsctl status res -t |
操作主機(jī):192.168.0.21,22,192.168.0.245,246,另一個(gè)備庫(kù)目前就沒(méi)有tnsnames,此次切換先不替換 su - oracle (四臺(tái)主機(jī)上執(zhí)行) cd $ORACLE_HOME/network/admin cp tnsnames.ora tnsnames.ora20210122 mv qiehuan_tnsnames.ora tnsnames.ora |
alter database recover managed standby database using current logfile disconnect from session; 新增服務(wù)名: alter system set db_unique_name=’testdb,testdb_new’; 手工注冊(cè): Alter system register; |
1:監(jiān)聽(tīng)正常
2:歸檔地址指定的tns正常
3:LOG_ARCHIVE_DEST_STATE_n是enable狀態(tài)
4:log_archive_configDG參數(shù)設(shè)置沒(méi)問(wèn)題
5:核實(shí)主庫(kù)alter日志,發(fā)現(xiàn)有連接報(bào)錯(cuò),經(jīng)核實(shí)主庫(kù)傳輸日志會(huì)多次嘗試目的地連通性問(wèn)題,多次嘗試不通以后會(huì)停止日志傳輸,此時(shí)只需要重新設(shè)置一些dg參數(shù),即可再次激活日志傳輸。
解決方案:altersystem set LOG_ARCHIVE_DEST_STATE_3=defer;
altersystem set LOG_ARCHIVE_DEST_STATE_3=enable;
重新設(shè)置一下即可激活日志傳輸,問(wèn)題解決。
lsnrctl status:
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/129975.html
摘要:年月日,遷移服務(wù)解決方案在城市峰會(huì)中正式發(fā)布。遷移服務(wù)向分布式架構(gòu)升級(jí)的直接路徑基于上述問(wèn)題和挑戰(zhàn),同時(shí)經(jīng)過(guò)螞蟻十年數(shù)據(jù)庫(kù)架構(gòu)升級(jí)的先進(jìn)經(jīng)驗(yàn),螞蟻金服為客戶(hù)打造了這款一站式數(shù)據(jù)遷移解決方案遷移服務(wù),簡(jiǎn)稱(chēng)。 2019年1月4日,OceanBase遷移服務(wù)解決方案在ATEC城市峰會(huì)中正式發(fā)布。螞蟻金服資深技術(shù)專(zhuān)家?guī)熚膮R和技術(shù)專(zhuān)家韓谷悅共同分享了OceanBase遷移服務(wù)的重要特性和業(yè)務(wù)實(shí)踐...
摘要:年月日,遷移服務(wù)解決方案在城市峰會(huì)中正式發(fā)布。遷移服務(wù)向分布式架構(gòu)升級(jí)的直接路徑基于上述問(wèn)題和挑戰(zhàn),同時(shí)經(jīng)過(guò)螞蟻十年數(shù)據(jù)庫(kù)架構(gòu)升級(jí)的先進(jìn)經(jīng)驗(yàn),螞蟻金服為客戶(hù)打造了這款一站式數(shù)據(jù)遷移解決方案遷移服務(wù),簡(jiǎn)稱(chēng)。 2019年1月4日,OceanBase遷移服務(wù)解決方案在ATEC城市峰會(huì)中正式發(fā)布。螞蟻金服資深技術(shù)專(zhuān)家?guī)熚膮R和技術(shù)專(zhuān)家韓谷悅共同分享了OceanBase遷移服務(wù)的重要特性和業(yè)務(wù)實(shí)踐...
閱讀 1353·2023-01-11 13:20
閱讀 1699·2023-01-11 13:20
閱讀 1211·2023-01-11 13:20
閱讀 1902·2023-01-11 13:20
閱讀 4161·2023-01-11 13:20
閱讀 2751·2023-01-11 13:20
閱讀 1397·2023-01-11 13:20
閱讀 3664·2023-01-11 13:20