ORACLE有DATA GUARD(ADG)、EXPDP/IMPDP、RMAN、存儲這四種遷移方式。
因為原數(shù)據(jù)庫有28TB數(shù)據(jù)量,業(yè)務(wù)不接受停機時間過長,無法使用EXPDP/IMPDP、RMAN、存儲方式完成數(shù)據(jù)庫遷移,所以本次遷移使用ADG方式遷移數(shù)據(jù)庫。
遷移過程
主庫環(huán)境
操作系統(tǒng):Red Hat 7.8
Oracle和grid版本 :19.11.0.0.210420
數(shù)據(jù)庫架構(gòu):RAC
存儲:ASM
備庫環(huán)境
操作系統(tǒng):Red Hat 7.9
Oracle和grid版本:19.11.0.0.210420
數(shù)據(jù)庫架構(gòu):單機
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
主庫已經(jīng)啟歸檔模式,如果未啟用需要先啟用歸檔模式。
SQL> select force_logging from v$database;
FORCE_LOGGING
---------------------------------------
YES
主庫已開啟強制日志,如果沒有啟用則需要開啟,開啟后需要做一次數(shù)據(jù)庫全備,在用NBU恢復(fù)時也需要用最新的全備進(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 備庫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 備庫IP:/oracle/app/oracle/product/19.0.0/db/dbs/orapworcl
scp orapworcl1 節(jié)點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 備庫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 = 備庫IP)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 節(jié)點1IP)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 節(jié)點2IP)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCLDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 備庫IP)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
lsnrctl start
主備庫添加白名后reload監(jiān)聽:
reload
Tnsping測試:
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)主庫和NBU缺失部分歸檔文件無法完成在備庫應(yīng)用,可以選擇主庫最新的全備文件重新進(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)說明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)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/129385.html
ElasticSearch索引跨集群遷移 img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; ...
摘要:題記三國時赤壁鏖戰(zhàn),孔明說,天有不測風(fēng)云,欲破曹公,宜用火攻,萬事俱備,只欠東風(fēng)?,F(xiàn)在公共云混戰(zhàn),我想說,無災(zāi)備不上云,保護數(shù)據(jù),未雨綢繆,帶了雨傘,還需雨衣。題記:三國時赤壁鏖戰(zhàn),孔明說,天有不測風(fēng)云,欲破曹公,宜用火攻,萬事俱備,只欠東風(fēng)?,F(xiàn)在公共云混戰(zhàn),我想說,無災(zāi)備不上云,保護數(shù)據(jù),未雨綢繆,帶了雨傘,還需雨衣。未雨綢繆,到底是帶雨傘還是雨衣呢?時代在變,人的追求也在變。隨著公共云對...
摘要:經(jīng)過與阿里云工程師的溝通決定使用阿里云的遷云工具來完成這次遷移。出現(xiàn)之后,打開阿里云控制臺,你會發(fā)現(xiàn)多了三個快照和一個鏡像然后用這個鏡像直接購買實例就可以了。 摘要: ERP物理機遷移至阿里云實踐 機房選型 隨著公司的不斷發(fā)展,業(yè)務(wù)量逐漸增大,對信息化的要求也越來越高,隨之對信息部的要求也越來越多,為此公司決定對現(xiàn)有的信息系統(tǒng)進(jìn)行升級改造. ERP物理機遷移至阿里云實踐 一、機房選...
摘要:災(zāi)難恢復(fù)服務(wù)和物聯(lián)網(wǎng)云存儲等技術(shù)越來越受到關(guān)注。下面,根據(jù)流行度,列舉了年閱讀量較高的一大云存儲技巧。在災(zāi)難發(fā)生后保護,并確保重要數(shù)據(jù)可用并不是一件小事,但是使用云存儲平臺可使提供商做更多的工作。自2016年起,我們已經(jīng)分析了十大重要存儲平臺,從實施混合云到制定數(shù)據(jù)遷移策略。對于云存儲來說,渡過了一個漫長而奇怪的一年。曾經(jīng)認(rèn)為的存儲時尚剛剛出現(xiàn)在各地,同時云遷移策略比以往更加廣泛了。對于一些...
摘要:基于云遷移的三個階段細(xì)分為八個主要步驟,評估階段主要包括項目啟動現(xiàn)狀梳理以及應(yīng)用系統(tǒng)關(guān)聯(lián)關(guān)系分析三個步驟,設(shè)計階段包括云架構(gòu)優(yōu)化設(shè)計和云遷移方案設(shè)計,實施階段包括目標(biāo)架構(gòu)遷移演練及實施和試運行三個步驟。 在云計算市場規(guī)模不斷擴大的大背景下,云遷移的需求越來越大且面臨挑戰(zhàn)。云遷移不是一個遷移軟件工具,而是一種服務(wù)。前IBM資深架構(gòu)師姜亞杰從云遷移的三個階段、四個維度到八個步驟的方法,簡述...
閱讀 1346·2023-01-11 13:20
閱讀 1684·2023-01-11 13:20
閱讀 1132·2023-01-11 13:20
閱讀 1858·2023-01-11 13:20
閱讀 4100·2023-01-11 13:20
閱讀 2704·2023-01-11 13:20
閱讀 1385·2023-01-11 13:20
閱讀 3597·2023-01-11 13:20