ORACLE有DATA GUARD(ADG)、EXPDP/IMPDP、RMAN、存儲(chǔ)這四種遷移方式。
因?yàn)樵瓟?shù)據(jù)庫(kù)有28TB數(shù)據(jù)量,業(yè)務(wù)不接受停機(jī)時(shí)間過(guò)長(zhǎng),無(wú)法使用EXPDP/IMPDP、RMAN、存儲(chǔ)方式完成數(shù)據(jù)庫(kù)遷移,所以本次遷移使用ADG方式遷移數(shù)據(jù)庫(kù)。
遷移過(guò)程
主庫(kù)環(huán)境
操作系統(tǒng):Red Hat 7.8
Oracle和grid版本 :19.11.0.0.210420
數(shù)據(jù)庫(kù)架構(gòu):RAC
存儲(chǔ):ASM
備庫(kù)環(huán)境
操作系統(tǒng):Red Hat 7.9
Oracle和grid版本:19.11.0.0.210420
數(shù)據(jù)庫(kù)架構(gòu):?jiǎn)螜C(jī)
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +ARCH
Oldest online log sequence 207743
Next log sequence to archive 207746
Current log sequence 207746
主庫(kù)已經(jīng)啟歸檔模式,如果未啟用需要先啟用歸檔模式。
SQL> select force_logging from v$database;
FORCE_LOGGING
---------------------------------------
YES
主庫(kù)已開(kāi)啟強(qiáng)制日志,如果沒(méi)有啟用則需要開(kāi)啟,開(kāi)啟后需要做一次數(shù)據(jù)庫(kù)全備,在用NBU恢復(fù)時(shí)也需要用最新的全備進(jìn)行恢復(fù)。
alter system set log_archive_config=DG_CONFIG=(orcl,orcladg) scope=both;
alter system set log_archive_dest_1=LOCATION=+ARCH valid_for=(all_logfiles,all_roles) db_unique_name=orcl scope=both;
alter system set log_archive_dest_2=SERVICE=orcladg lgwr sync valid_for=(online_logfile,primary_role) db_unique_name=orcladg scope=both;
alter system set log_archive_dest_state_2=defer scope=both;
alter system set fal_client=orcl scope=both;
alter system set fal_server=orcladg scope=both;
alter system set standby_file_management=auto scope=both;
SQL> select THREAD#,BYTES/1024/1024 from v$log;
THREAD# BYTES/1024/1024
---------- ---------------
1 1024
1 1024
2 1024
2 1024
查詢?nèi)罩窘M數(shù)量和路徑:
col MEMBER for a80;
col TYPE for a10;
set lin240 pages999;
select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_ CON_ID
------ ------ ------ ----------------------------------------- --- -------
1 ONLINE +DATA/ORCL/ONLINELOG/group_1.258.1061077801 NO 0
2 ONLINE +DATA/ORCL/ONLINELOG/group_2.259.1061077801 NO 0
3 ONLINE +DATA/ORCL/ONLINELOG/group_3.270.1061083275 NO 0
4 ONLINE +DATA/ORCL/ONLINELOG/group_4.271.1061083275 NO 0
alter database add standby logfile thread 1 group 5 +DATA size 1024m;
alter database add standby logfile thread 1 group 6 +DATA size 1024m;
alter database add standby logfile thread 1 group 7 +DATA size 1024m;
alter database add standby logfile thread 2 group 8 +DATA size 1024m;
alter database add standby logfile thread 2 group 9 +DATA size 1024m;
alter database add standby logfile thread 2 group 10 +DATA size 1024m;
create pfile=/tmp/init.ora from spfile;
scp /tmp/init.ora 備庫(kù)IP:/oracle/app/oracle/product/19.0.0/db/dbs/initorcl.ora
*.audit_file_dest=/oracle/app/oracle/admin/orcl/adump
*.audit_trail=NONE
*.cluster_database=FALSE
*.compatible=19.0.0
*.control_files=+data/ORCL/CONTROLFILE/xxxx
*.db_block_size=8192
*.db_cache_size=60129542144
*.db_create_file_dest=+DATA
*.db_domain=
*.db_files=2000
*.db_name=orcl
*.db_unique_name=orcldg
*.diagnostic_dest=/oracle/app/oracle
*.dispatchers=(PROTOCOL=TCP) (SERVICE=orclXDB)
*.event=28401 trace name context forever,level 1
*.java_jit_enabled=TRUE
*.fal_client=orcldg
*.fal_server=orcl
*.log_archive_config=DG_CONFIG=(orcldg,orcl)
*.log_archive_dest_1=LOCATION=+arch
*.log_archive_dest_3=SERVICE=orcl lgwr sync valid_for=(online_logfile,primary_role) db_unique_name=orcl
*.log_archive_dest_state_2=ENABLE
*.open_cursors=1000
*.parallel_max_servers=128
*.parallel_min_servers=32
*.parallel_servers_target=128
*.pga_aggregate_target=27068989440
*.processes=3000
*.remote_login_passwordfile=exclusive
*.service_names=orcl
*.session_cached_cursors=200
*.sessions=3305
*.sga_target=100G
*.standby_file_management=auto
*.undo_retention=3600
*.undo_tablespace=UNDOTBS1
cd /oracle/app/oracle/product/19.0.0/dbhome_1/dbs
scp orapworcl1 備庫(kù)IP:/oracle/app/oracle/product/19.0.0/db/dbs/orapworcl
scp orapworcl1 節(jié)點(diǎn)2IP:/oracle/app/oracle/product/19.0.0/db/dbs/orapworcl2
SQL> alter database create standby controlfile as /tmp/standby.ctl;
scp /tmp/standby.ctl 備庫(kù)IP:/tmp/standby.ctl;
rman target /
startup pfile=/oracle/app/oracle/product/19.0.0/db/dbs/initorcl.ora nomount;
RMAN> restore standby controlfile to +DATA FROM /tmp/standby.ctl;
mkdir -p /oracle/app/oracle/admin/orcl/adump
ORCLDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 備庫(kù)IP)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 節(jié)點(diǎn)1IP)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 節(jié)點(diǎn)2IP)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCLDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 備庫(kù)IP)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
lsnrctl start
主備庫(kù)添加白名后reload監(jiān)聽(tīng):
reload
Tnsping測(cè)試:
tnsping ORCL
tnsping ORCLDG
vi nbu_rman.sh
#!/bin/bash
source /home/oracle/.bash_profile
rman target / < run{
ALLOCATE CHANNEL c0 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
ALLOCATE CHANNEL c1 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
ALLOCATE CHANNEL c2 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
ALLOCATE CHANNEL c3 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
ALLOCATE CHANNEL c4 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
ALLOCATE CHANNEL c5 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
restore database;
recover database;
RELEASE CHANNEL c0;
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;
RELEASE CHANNEL c5;
}
EOF
SQL> alter system set log_archive_dest_state_2=enable scope=both;
alter database recover managed standby database using current logfile disconnect from session;
PR00 (PID:112926): FAL: Failed to request gap sequence
PR00 (PID:112926): GAP - thread 1 sequence 211212-211250
PR00 (PID:112926): DBID 1915883988 branch 1085828161
PR00 (PID:112926): FAL: All defined FAL servers have been attempted
PR00 (PID:112926): -------------------------------------------------------------------------
PR00 (PID:112926): Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
PR00 (PID:112926): parameter is defined to a value thats sufficiently large
PR00 (PID:112926): enough to maintain adequate log switch information to resolve
PR00 (PID:112926): archived redo log gaps.
PR00 (PID:112926): -------------------------------------------------------------------------
如果存現(xiàn)主庫(kù)和NBU缺失部分歸檔文件無(wú)法完成在備庫(kù)應(yīng)用,可以選擇主庫(kù)最新的全備文件重新進(jìn)行恢復(fù)。
RMAN> configure CHANNEL device type SBT_TAPE PARMS ENV=
(NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx);
RMAN> list backup of archivelog all;
RMAN> catalog device type SBT_TAPE backuppiece arch_xxxx1;
RMAN> catalog device type SBT_TAPE backuppiece arch_xxxx2;
RMAN> CONFIGURE CHANNEL DEVICE TYPE SBT_TAPE CLEAR;
run {
ALLOCATE CHANNEL c0 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
ALLOCATE CHANNEL c1 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
restore archivelog sequence between xxxx1 and xxxx8;
RELEASE CHANNEL c0;
RELEASE CHANNEL c1;
}
run{
ALLOCATE CHANNEL c1 TYPE SBT_TAPE SEND NB_ORA_SERV=NBUmaster,NB_ORA_CLIENT=xxxx,NB_ORA_DISK_MEDIA_SERVER=xxxx;
restore archivelog sequence between xxxx2 and xxxx6 thread 2;
RELEASE CHANNEL c1;
}
alter database recover managed standby database cancel;
alter database open;
alter database recover managed standby database using current logfile disconnect from session;
SQL> select OPEN_MODE from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
以上狀態(tài)說(shuō)明ORACLE ADG搭建成功。
alter database recover managed standby database cancel;
shutdown immediate;
startup mount;
alter database flashback on;
alter database open;
alter system set log_archive_dest_state_2=defer;
select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY
alter database activate standby database;
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/129385.html
ElasticSearch索引跨集群遷移 img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; ...
摘要:題記三國(guó)時(shí)赤壁鏖戰(zhàn),孔明說(shuō),天有不測(cè)風(fēng)云,欲破曹公,宜用火攻,萬(wàn)事俱備,只欠東風(fēng)。現(xiàn)在公共云混戰(zhàn),我想說(shuō),無(wú)災(zāi)備不上云,保護(hù)數(shù)據(jù),未雨綢繆,帶了雨傘,還需雨衣。題記:三國(guó)時(shí)赤壁鏖戰(zhàn),孔明說(shuō),天有不測(cè)風(fēng)云,欲破曹公,宜用火攻,萬(wàn)事俱備,只欠東風(fēng)。現(xiàn)在公共云混戰(zhàn),我想說(shuō),無(wú)災(zāi)備不上云,保護(hù)數(shù)據(jù),未雨綢繆,帶了雨傘,還需雨衣。未雨綢繆,到底是帶雨傘還是雨衣呢?時(shí)代在變,人的追求也在變。隨著公共云對(duì)...
摘要:經(jīng)過(guò)與阿里云工程師的溝通決定使用阿里云的遷云工具來(lái)完成這次遷移。出現(xiàn)之后,打開(kāi)阿里云控制臺(tái),你會(huì)發(fā)現(xiàn)多了三個(gè)快照和一個(gè)鏡像然后用這個(gè)鏡像直接購(gòu)買實(shí)例就可以了。 摘要: ERP物理機(jī)遷移至阿里云實(shí)踐 機(jī)房選型 隨著公司的不斷發(fā)展,業(yè)務(wù)量逐漸增大,對(duì)信息化的要求也越來(lái)越高,隨之對(duì)信息部的要求也越來(lái)越多,為此公司決定對(duì)現(xiàn)有的信息系統(tǒng)進(jìn)行升級(jí)改造. ERP物理機(jī)遷移至阿里云實(shí)踐 一、機(jī)房選...
摘要:災(zāi)難恢復(fù)服務(wù)和物聯(lián)網(wǎng)云存儲(chǔ)等技術(shù)越來(lái)越受到關(guān)注。下面,根據(jù)流行度,列舉了年閱讀量較高的一大云存儲(chǔ)技巧。在災(zāi)難發(fā)生后保護(hù),并確保重要數(shù)據(jù)可用并不是一件小事,但是使用云存儲(chǔ)平臺(tái)可使提供商做更多的工作。自2016年起,我們已經(jīng)分析了十大重要存儲(chǔ)平臺(tái),從實(shí)施混合云到制定數(shù)據(jù)遷移策略。對(duì)于云存儲(chǔ)來(lái)說(shuō),渡過(guò)了一個(gè)漫長(zhǎng)而奇怪的一年。曾經(jīng)認(rèn)為的存儲(chǔ)時(shí)尚剛剛出現(xiàn)在各地,同時(shí)云遷移策略比以往更加廣泛了。對(duì)于一些...
摘要:基于云遷移的三個(gè)階段細(xì)分為八個(gè)主要步驟,評(píng)估階段主要包括項(xiàng)目啟動(dòng)現(xiàn)狀梳理以及應(yīng)用系統(tǒng)關(guān)聯(lián)關(guān)系分析三個(gè)步驟,設(shè)計(jì)階段包括云架構(gòu)優(yōu)化設(shè)計(jì)和云遷移方案設(shè)計(jì),實(shí)施階段包括目標(biāo)架構(gòu)遷移演練及實(shí)施和試運(yùn)行三個(gè)步驟。 在云計(jì)算市場(chǎng)規(guī)模不斷擴(kuò)大的大背景下,云遷移的需求越來(lái)越大且面臨挑戰(zhàn)。云遷移不是一個(gè)遷移軟件工具,而是一種服務(wù)。前IBM資深架構(gòu)師姜亞杰從云遷移的三個(gè)階段、四個(gè)維度到八個(gè)步驟的方法,簡(jiǎn)述...
閱讀 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