OGG 12c mysql複製到oracle部署方案
OGG 12c mysql 複製到 oracle 部署方案
1、 環境
源端資料庫: mysql 5.7.31
目標端資料庫: oracle 11.2.0.4
源端 ogg 介質: 122022_ggs_Linux_x64_MySQL_64bit
目標端 ogg 介質: 122022_fbo_ggs_Linux_x64_shiphome
注意:
( 1 )這裡使用 ogg 12.2.0.2 的版本,如果使用低版本,抽取程式啟動會報 600 錯誤
( 2 )兩端使用的版本儘量一致,不然使用直接載入的初始化方式在啟動的時候會報版本錯誤,且直接載入方式的初始化程式不支援 FORMAT RELEASE(LEVEL) 配置
Mysql 端 122022_ggs_Linux_x64_MySQL_64bit 解壓後即可使用
Oracle 端 122022_fbo_ggs_Linux_x64_shiphome 修改模板,使用靜默安裝
( 3 )雖然 mysql 端設定了表名大小寫不敏感的引數 lower_case_table_names=1 ,但是 ogg 對錶名大小寫依然敏感。
2 、源端配置
2.1 Mysql 引數許可權
與 ogg 相關的 Mysql 資料庫引數配置
binlog-format=ROW
log-bin=mysql-bin
需要同步的表要先授權
>GRANT INSERT, UPDATE, DELETE,select ON `psd`.`test` TO 'ogg'@'%';
2.2 管理程式: mgr
> view param mgr PORT 1739 DYNAMICPORTLIST 1740-1838 AUTORESTART EXTRACT *,RETRIES 999,WAITMINUTES 3 STARTUPVALIDATIONDELAY 5 PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPDAYS 3 LAGREPORTHOURS 1 LAGINFOMINUTES 30 LAGCRITICALMINUTES 45
2.3 抽取程式: extpr
> view param extpr extract extpr setenv(MYSQL_HOME="/usr/") sourcedb ogg@196.14.1.1:13306,userid ogg,password ogg tranlogoptions altlogdest /mysql/mdata/mysql-bin.index discardfile ./dirrpt/extbpm.dsc,append,megabytes 1024 exttrail ./dirdat/bp gettruncates dynamicresolution table psd.test,keycols(ID);
MYSQL_HOME 可以透過執行 show variables like '%basedir%' 來確定
tranlogoptions altlogdest 配置的是 log-bin 的 index 檔案,可以透過檢視 my.cnf 配置檔案確定,也可以執行 show variables like '%datadir%' 來確定
2.4 傳輸程式 :dpepr
> view param dpepr extract dpepr sourcedb ogg@196.14.1.1:13306,userid ogg,password ogg rmthost 196.14.1.2,mgrport 1639 rmttrail ./dirdat/bp gettruncates table psd.test,keycols(ID);
2.5 源端初始化程式 :extinit
> view param extinit extract extinit setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8) sourcedb ogg@196.14.1.1:13306,userid ogg,password ogg rmthost 196.14.1.2,mgrport 1639 RMTTASK REPLICAT,GROUP repinit ---對應的目標端初始化程式名 table psd.test,keycols(ID);
2.6 生成 def 檔案
在 ogg 主目錄新建一個 repdef.prm 檔案
>vi repdef.prm defsfile ./dirdef/repdef.def,purge sourcedb ogg@196.14.1.1:13306,userid ogg,password ogg table psd.test;
生成 def 檔案
>./defgen paramfile repdef.prm
3 、目標端配置
3.1 靜默安裝 ogg
3.1.1 修改屬主
> chown oracle:dba fbo_ggs_Linux_x64_shiphome/ -R
3.1.2 修改安裝模板檔案
fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp 中的以下兩個引數,根據實際情況配置,其他的引數不要動。
INSTALL_OPTION=ORA11g
SOFTWARE_LOCATION=/ogg/dogg
3.1.3 執行安裝
> ./runInstaller -silent -responseFile /dogg/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 40776 MB Passed Checking swap space: must be greater than 150 MB. Actual 20225 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-03-13_02-56-14PM. Please wait ...oracle@yxchdb03:/ogg/odpogg/fbo_ggs_Linux_x64_shiphome/Disk1$ [WARNING] [INS-75003] The specified directory /ogg/odpogg is not empty. CAUSE: The directory specified /ogg/odpogg contains files. ACTION: Clean up the specified directory or enter a new directory location. [WARNING] [INS-75017] Cluster detected: Unable to determine if the specified software location is shared. It is recommended to install Oracle GoldenGate entirely on shared storage. CAUSE: One or more cluster nodes may be unreachable or the specified software location may not be accessible from one or more nodes. ACTION: Specify the software location on a shared storage. You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2022-03-13_02-56-14PM.log WARNING:OUI-10030:You have specified a non-empty directory to install this product. It is recommended to specify either an empty or a non-existent directory. You may, however, choose to ignore this message if the directory contains Operating System generated files or subdirectories like lost+found. Do you want to proceed with installation in this Oracle Home? The installation of Oracle GoldenGate Core was successful. Please check '/u01/app/oraInventory/logs/silentInstall2022-03-13_02-56-14PM.log' for more details. Successfully Setup Software.
3.1.4 建立目錄
oracle@yxdb:/ogg/dogg$ ./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419_FBO Linux, x64, 64bit (optimized), Oracle 11g on Jun 30 2017 14:42:26 Operating system character set identified as UTF-8. Copyright (C) 1995, 2017, Oracle and/or its affiliates. All rights reserved. > create subdirs Creating subdirectories under current directory /ogg/odpogg Parameter files /ogg/dogg/dirprm: created Report files /ogg/dogg/dirrpt: created Checkpoint files /ogg/dogg/dirchk: created Process status files /ogg/dogg/dirpcs: created SQL script files /ogg/dogg/dirsql: created Database definitions files /ogg/dogg/dirdef: created Extract data files /ogg/dogg/dirdat: created Temporary files /ogg/dogg/dirtmp: created Credential store files /ogg/dogg/dircrd: created Masterkey wallet files /ogg/dogg/dirwlt: created Dump files /ogg/dogg/dirdmp: created
3.1 入庫程式 reppr
> view param reppr REPLICAT reppr SETENV(ORACLE_SID = "fjdb") SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2/db_1") setenv (NLS_LANG=AMERICAN_AMERICA.UTF8) USERID ogg, PASSWORD ogg REPERROR DEFAULT,DISCARD SOURCEDEFS /ogg/dirdef/repdef.def DISCARDFILE ./dirrpt/reppr.dsc, APPEND, MEGABYTES 1024 DYNAMICRESOLUTION map psd.test,target bpm.test,KEYCOLS(ID);
3.2 目標端初始化程式 repinit
> view param repinit REPLICAT repinit USERID ogg, PASSWORD ogg SOURCEDEFS ./dirdef/reppr.def REPERROR(-1,IGNORE) REPERROR DEFAULT,DISCARD map psd.test,target bpm.test,KEYCOLS(ID);
4、 新增並啟動程式
4.1 新增程式
4.1.1 源端
GGSCI (yxdb) 16> add extract extpr,tranlog,begin now GGSCI (yxdb) 17> add exttrail ./dirdat/bp,extract extpr,MEGABYTES 512 GGSCI (yxdb) 18> add extract dpepr,exttrailsource ./dirdat/bp GGSCI (yxdb) 19> add rmttrail ./dirdat/bp,extract dpepr,MEGABYTES 512 GGSCI (yxdb) 20> add extract extinit,sourceistable EXTRACT added.
4.1.2 目標端
>add replicat reppr,exttrail ./dirdat/bp,checkpointtable ogg.checkpointtab >add replicat repinit,specialrun
4.2 啟動程式
4.2.1 源端
啟動初始化程式
GGSCI (yxdb) 16>start extinit
執行該命令後後,目標端會自動啟動初始化複製程式repinit,初始化完成後,會自動停止,在目標端執行info *,task可以檢視初始化程式資訊。
源端日誌: 2022-03-15 08:53:37 INFO OGG-02911 Oracle GoldenGate Capture for MySQL, extinit.prm: Processing table psd.tb1. 2022-03-15 08:53:41 INFO OGG-02911 Oracle GoldenGate Capture for MySQL, extinit.prm: Processing table psd.tb2. 2022-03-15 08:53:49 INFO OGG-02911 Oracle GoldenGate Capture for MySQL, extinit.prm: Processing table psd.tb3. 目標端日誌: 2022-03-15 08:53:37 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, repinit.prm: REPLICAT REPINIT started. 2022-03-15 08:53:37 WARNING OGG-02761 Oracle GoldenGate Delivery for Oracle, repinit.prm: Source definitions file, ./dirdef/repbpm.def, is ignored because trail file contains table definitions. 2022-03-15 08:53:37 INFO OGG-06505 Oracle GoldenGate Delivery for Oracle, repinit.prm: MAP resolved (entry psd_bpm.bpm_worklist_cur): map "psd"."tb1",target bpm.tb1,KEYCOLS(ID). 2022-03-15 08:53:37 INFO OGG-02756 Oracle GoldenGate Delivery for Oracle, repinit.prm: The definition for table psd.tb1 is obtained from the trail file. 2022-03-15 08:53:37 INFO OGG-06511 Oracle GoldenGate Delivery for Oracle, repinit.prm: Using following columns in default map by name: INSTANCE_ID, INSTANCE_NAME, TASK_ID, FROM_TASK_ID, NODE_ID, NODE_NAME, OVERDUR_DATE, REMARK, OVER_REASON, HANDLE_CONTENT,TENANT_ID. 2022-03-15 08:53:37 INFO OGG-06510 Oracle GoldenGate Delivery for Oracle, repinit.prm: Using the following key columns for target table BPM.tb1: ID.
待初始化完成後,啟動抽取和傳輸程式
GGSCI (yxdb) 16>start extract extpr
GGSCI (yxdb) 16>start extract dpepr
4.2.2 目標端
GGSCI (yxdb) 16>start replicat reppr
觀察日誌,資料驗證
5 、問題解決
Q1 :啟動抽取程式報 error 600
2022-03-11 10:39:01 ERROR OGG-00146 VAM function VAMRead returned unexpected result: error 600 - VAM Client Report <CAUSE OF FAILURE : Sanity Check Failed for events
WHEN FAILED : While reading log event from binary log
WHERE FAILED : MySQLBinLog Reader Module
CONTEXT OF FAILURE : No Information Available!>.
解決方法: 源端 mysql 使用 OGG-11.2.0.1 ,啟動抽取程式會報上面的錯誤,需要升級到 12.2.0.2 以上版本。
Q2 :入庫程式啟動報 ERROR OGG-05302
2022-03-14 08:29:56 INFO OGG-03506 Oracle GoldenGate Delivery for Oracle, repbpm.prm: The source database character set, as determined from the trail file, is UTF-8.
2022-03-14 08:29:56 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, repbpm.prm: Repositioning to rba 1853080 in seqno 6.
2022-03-14 08:29:56 ERROR OGG-05302 Oracle GoldenGate Delivery for Oracle, repbpm.prm: An error occured while doing commit handling.
2022-03-14 08:29:56 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, repbpm.prm: PROCESS ABENDING.
解決方法: 更新檢查點資訊,啟動程式(建議重新初始化)
>dblogin userid username,password pwd
>upgrade checkpointtable ogg.checkpointtab
Q3 :抽取程式無資料生成
抽取程式啟動後不報錯, trail 檔案大小不增長
解決方法: 表名大小寫問題,修改程式中的表名大小寫與資料庫字典中的一致
Q4 :傳輸程式資料不傳輸
傳輸程式啟動後不報錯,目標端 trail 檔案大小不增長
解決方法: 表名大小寫問題,修改程式中的表名大小寫與資料庫字典中的一致
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31374736/viewspace-2871626/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- OGG_mysql 12c複製到OGG_oracle 11g部署方案MySqlOracle
- 配置OGG到MYSQL複製時登陸MYSQL報錯解決MySql
- OGG 12c MySQL to MySQLMySql
- ogg12 oracle to oracle 雙向DDL複製Oracle
- MySQL 8 複製(八)——組複製安裝部署MySql
- 配置ogg異構oracle到mysqlOracleMySql
- Windows Mysql主從複製部署WindowsMySql
- MySQL主從複製環境部署MySql
- OGG 複製程式拆分
- MYSQL主從複製製作配置方案MySql
- Mysql MHA部署-02主從複製MySql
- Mysql分散式部署 - 多級複製MySql分散式
- mysql主從複製詳細部署MySql
- MySQL 主從複製安裝部署配置MySql
- MYSQL並行複製(parallel replication部署篇)MySql並行Parallel
- mysql5.5.9半同步複製功能部署MySql
- OGG雙向DML複製操作
- OGG單向DDL複製操作
- ORACLE複製舊錶到新表Oracle
- ogg 併發複製程式自阻塞
- MySQL 同步複製及高可用方案總結MySql
- MySQL主從複製延遲解決方案MySql
- Oracle 19C OGG基礎運維-06增加複製表Oracle運維
- MySQL複製MySql
- MySQL 複製MySql
- Sqlstream:將MySQL複製事件流化到Apache KafkaMySql事件ApacheKafka
- 藉助ogg完成oracle到mysql的資料遷移OracleMySql
- mysql複製--主從複製配置MySql
- OGG 的配置:不使用資料泵完成Oracle-Oracle的雙向複製。Oracle
- OGG複製程式掛起abended處理
- 關於不同的MySQL複製解決方案概述MySql
- Oracle 19C OGG基礎運維-07減少複製表Oracle運維
- 使用事件溯源、Kafka和OGG從Oracle內部複製資料事件KafkaOracle
- MySQL入門--MySQL複製技術之部署中遇到的問題MySql
- MySQL入門--MySQL複製技術之主從複製MySql
- MySQL入門--MySQL複製技術之主主複製MySql
- 從 MySQL 到 ClickHouse 實時複製與實現MySql
- MySQL 8 複製(三)——延遲複製與部分複製MySql