跨平臺級聯dataguard配置
正式環境中的OA庫要從Windows遷移到Linux,但由於資料量比較大,頻寬又比較窄,資料泵方式耗時太長,因此打算用DataGuard方式遷移,因此進行了測試。
環境
主庫:OS:Windows VERSION:11.2.0.4 ORACLE_SID:OA DB_NAME:OA DB_UNIQUE_NAME:OA
備庫:OS:Windows VERSION:11.2.0.4 ORACLE_SID:OA DB_NAME:OA DB_UNIQUE_NAME:OA_DG
級聯備庫:OS:Linux VERSION:11.2.0.4 ORACLE_SID:OA DB_NAME:OA DB_UNIQUE_NAME:OA_DG2
1.檢視各庫平臺資訊
SQL>select platform_id,platform_name from v$database;
主庫與備庫相同:
PLATFORM_ID PLATFORM_NAME
----------- ----------------------------
12 Microsoft Windows x86 64-bit
級聯備庫:
PLATFORM_ID PLATFORM_NAME
----------- ---------------------------
13 Linux x86 64-bit
檢視相容表格,可看到當前的平臺與Oracle版本是可跨平臺搭建DataGuard的,但是要打Patch 13104881(當前版本已打)
2.備庫生成pfile,並將pfile、密碼檔案傳輸到OA_DG2相關目錄下
3.級聯備庫上修改pfile
[oracle@node3 dbs]$ more initOA.ora
*. audit_file_dest ='/opt/app/oracle/admin/OA/adump'
*.audit_trail='DB'
*.compatible='11.2.0.0.0'
*. control_files ='/opt/app/oracle/oradata/OA/CONTROL01.CTL','/opt/app/oracle/fast_recovery_area/OA/CONTROL02.CTL'
*.db_block_size=8192
*.db_name='OA'
*.db_recovery_file_dest_size=4102029312
*. db_recovery_file_dest ='/opt/app/oracle/fast_recovery_area'
*. db_unique_name ='OA_DG2'
*. diagnostic_dest ='/opt/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=OAXDB)'
*. fal_client ='OA_DG2'
*. fal_server ='OA_DG'
*. db_file_name_convert ='C:\APP\ADMINISTRATOR\ORADATA\OA\','/opt/app/oracle/oradata/OA/','C:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\OA\','/opt/app/oracle/fast_recovery_area/OA/'
*. log_file_name_convert ='C:\APP\ADMINISTRATOR\ORADATA\OA\','/opt/app/oracle/oradata/OA/'
*. log_archive_config ='dg_config=(OA,OA_DG,OA_DG2)'
*.log_archive_dest_1='location=/opt/app/oracle/archivelog valid_for=(all_logfiles,all_roles)
*.log_archive_format='ARC%S_%R.%T'
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=428867584
*.processes=150
*.recyclebin='OFF'
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1291845632
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
修改紅色字型部分,使其適應當前環境
4.級聯備庫上建立所需目錄
cd $ORACLE_BASE
mkdir -p oradata/OA/adump
mkdir -p oradata/OA
mkdir -p fast_recovery_area/OA
5.新增tns
備庫新增級聯備庫的tns
OA_DG2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.21.74.231)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oa)
)
)
級聯備庫新增備庫的tns
OA_DG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.21.74.233)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oa)
)
)
6.修改備庫引數,將standby logfile傳輸到級聯備庫
SQL> alter system set log_archive_dest_state_3=defer; --暫時關閉
SQL> alter system set log_archive_config='dg_config=(OA,OA_DG,OA_DG2)';
SQL> alter system set log_archive_dest_3='service=OA_DG2 async valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=OA_DG2'
7.級聯備庫配置靜態監聽
[oracle@node3 admin]$ more listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.21.74.231)(PORT = 1521))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME = OA)
(ORACLE_HOME = /opt/app/oracle/product/11g)
(GLOBAL_DBNAME = OA)
)
)
ADR_BASE_LISTENER = /opt/app/oracle
8.使用RMAN的複製功能建立備庫:
1)lsnrctl start
2)rman target sys@primary auxiliary sys@standby
3)duplicate target database for standby from active database;
如果報錯RMAN-05001: auxiliary file name /opt/app/oracle/oradata/orcl/users01.dbf conflicts with a file used by the target database,則執行duplicate target database for standby from active database nofilenamecheck;
也可以並行複製以提高效能。需要分派主庫和備庫多個通道後,再執行復制命令:
run
{
allocate channel chan1 type disk;
allocate channel chan2 type disk;
allocate channel chan3 type disk;
allocate channel chan4 type disk;
allocate auxiliary channel aux1 type disk;
allocate auxiliary channel aux2 type disk;
allocate auxiliary channel aux3 type disk;
allocate auxiliary channel aux4 type disk;
duplicate target database for standby from active database;
}
9.複製完成後,驗證級聯備庫中各檔案路徑是否正確
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/OA/USERS01.DBF
/opt/app/oracle/oradata/OA/UNDOTBS01.DBF
/opt/app/oracle/oradata/OA/SYSAUX01.DBF
/opt/app/oracle/oradata/OA/SYSTEM01.DBF
SQL> select group#,member from v$logfile;
GROUP# TYPE MEMBER
---------- ------ --------------------------------------------------
3 ONLINE /opt/app/oracle/oradata/OA/REDO03.LOG
2 ONLINE /opt/app/oracle/oradata/OA/REDO02.LOG
1 ONLINE /opt/app/oracle/oradata/OA/REDO01.LOG
4 STANDBY C:\APP\ADMINISTRATOR\ORADATA\OA\STANDBYREDO04.LOG
5 STANDBY C:\APP\ADMINISTRATOR\ORADATA\OA\STANDBYREDO05.LOG
6 STANDBY C:\APP\ADMINISTRATOR\ORADATA\OA\STANDBYREDO06.LOG
7 STANDBY C:\APP\ADMINISTRATOR\ORADATA\OA\STANDBYREDO07.LOG
7 rows selected.
可看到standby redo的目錄不正確(貌似log_file_name_convert對standby log沒起作用),此時可手動刪掉standby日誌組,再重新新增:
SQL> alter database drop standby logfile group 4;
SQL> alter database drop standby logfile group 5;
SQL> alter database drop standby logfile group 6;
SQL> alter database drop standby logfile group 7;
SQL> alter database add standby logfile group 4 ('/opt/app/oracle/oradata/OA/STANDBYRD04.LOG') size 50M;
SQL> alter database add standby logfile group 5 ('/opt/app/oracle/oradata/OA/STANDBYRD05.LOG') size 50M;
SQL> alter database add standby logfile group 6 ('/opt/app/oracle/oradata/OA/STANDBYRD06.LOG') size 50M;
SQL> alter database add standby logfile group 7 ('/opt/app/oracle/oradata/OA/STANDBYRD07.LOG') size 50M;
驗證完畢後開啟備庫的傳輸引數
SQL> alter system set log_archive_dest_3_state=enable;
驗證傳輸是否正常,在級聯備庫執行
SQL> SELECT PROCESS,
2 PID,
3 STATUS,
4 SEQUENCE#,
5 DELAY_MINS
6 FROM V$MANAGED_STANDBY;
PROCESS PID STATUS SEQUENCE# DELAY_MINS
------------------------------ ---------- -------------------- ---------- ----------
ARCH 30382 CLOSING 158 0
ARCH 30384 CLOSING 154 0
ARCH 30386 CONNECTED 0 0
ARCH 30388 CLOSING 155 0
RFS 32195 IDLE 0 0
RFS 32193 IDLE 0 0
RFS 32191 IDLE 0 0
可看到RFS程式已經建立,說明傳輸沒有問題。(如果傳輸有問題,可結合備庫的alert日誌進行處理,應該就是密碼檔案的問題)
10.級聯備庫啟動實時應用
啟動日誌應用:
alter database recover managed standby database disconnect;
這個命令指示備庫開始使用歸檔日誌檔案進行恢復。
待歸檔日誌應用完畢後,啟動實時應用:
SQL> alter database recover managed standby database cancel;
SQL> alter database open;
SQL> alter database recover managed standby database using current logfile disconnect; - -雖然語句執行後MRP程式啟動成功,但驗證下來還是沒有真正實時應用日誌。
驗證實時應用情況:
SQL> SELECT * FROM V$DATAGUARD_STATS;
NAME VALUE UNIT TIME_COMPUTED DATUM_TIME
------------------------------ ------------------------------ ---------------------------------------- ------------------------------ ------------------------------
transport lag +00 00:05:22 day(2) to second(0) interval 11/01/2018 17:44:19 11/01/2018 17:43:28
apply lag +00 00:05:22 day(2) to second(0) interval 11/01/2018 17:44:19 11/01/2018 17:43:28
apply finish time day(2) to second(3) interval 11/01/2018 17:44:19
estimated startup time 11 second
注意:Oracle 11g的級聯備庫是不支援實時應用的,要等源庫日誌切換後才會應用。Oracle 12c的級聯備庫支援實時應用。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31544156/viewspace-2218437/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle DataGuard跨平臺支援列表Oracle
- 附錄A Oracle Dataguard 物理Standby跨平臺組合支援列表Oracle
- rust跨平臺Rust
- flutter跨平臺開發之App升級方案FlutterAPP
- datapump跨平臺升級遷移的總結
- 微軟借力.NET開源跨平臺支援,佈局物聯網平臺開發微軟
- 虹盤雲相簿:拉近家庭距離,跨平臺互聯
- 跨平臺編譯編譯
- .NET Core 跨平臺
- WPF跨平臺方案?
- rman 跨平臺支援
- VNC 跨平臺copyVNC
- JVM跨平臺原理JVM
- Java跨平臺原理Java
- oracle 12c 支援級聯 standby dataguardOracle
- 在異構平臺配置Oracle11gR2 Streams同時再配置相同平臺的Oracle11gR2 DataguardOracle
- DataGuard對異構平臺的支援
- JAVA的跨平臺原理Java
- 傳真系統的跨平臺相容和更換升級
- 【開源】C#跨平臺物聯網通訊框架ServerSuperIO(SSIO)C#框架Server
- .NET 跨平臺工業物聯網閘道器解決方案
- onethink支援跨平臺嗎
- 跨平臺技術演進
- Go跨平臺交叉編譯Go編譯
- 跨平臺同步筆記工具筆記
- 跨平臺`ChatGpt` 客戶端ChatGPT客戶端
- ORACLE 跨平臺遷移方法Oracle
- .NET Core 跨平臺釋出
- 應用跨平臺問題?
- 解析超級買手遊戲廠商:低估值、跨平臺、渠道式微遊戲
- 南沙物聯網國家級平臺通過驗收
- 《Sky光·遇》將登陸NS、PS4 支援跨平臺聯機
- [Flutter翻譯]Flutter時代的多平臺VS跨平臺Flutter
- Oracle 10g 跨平臺傳輸 相容平臺列表Oracle 10g
- 跨平臺、跨主機共享鍵鼠方案(KVM)
- Oracle 10G windows 平臺 DataGuard 例項Oracle 10gWindows
- 一個工業級、跨平臺、輕量級的 tcp 網路服務框架:geventTCP框架
- 打造跨平臺.NET Core後臺服務