您好,登錄后才能下訂單哦!
本篇內容介紹了“GoldenGate的基本原理介紹”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
官方定義:
Oracle GoldenGate is a comprehensive software package for real-time data integration and replication in heterogeneous IT environments.The product set enables high availability solutions, real-time data integration, transactional change data capture, data replication, transformations, and verification between operational and analytical enterprise systems.
大白話版:
Oracle GoldenGate(OGG)只會做一件事:復制數據。除此之外,啥也不會。
專一
高效
跨平臺
支持的數據庫:
Oracle
DB2
SQL Server
NonStop SQL/MX
Sybase
Teradata
TimesTen
PostgreSQL
Informix
支持的平臺:
Unix(Solaris,AIX,HP-UX)
Linux
Windows
z/OS
HP NonStop
支持的操作:
DML
DDL
LGWR: Log Writer Process
日志寫進程,將緩存中的Change Vector寫入到文件(Online Redo Log)中
ARCn: Archiver Processes
歸檔進程,對Online Redo Log進行拷貝
Redo Log:
記錄數據庫的變更數據(Change Vector)。
分為:Online Redo Log和Archived Redo Log
主要進程:
Manager
總控進程
管理其它進程
管理網絡端口
管理TRAIL文件
管理運行日志
Extract
數據抓取
數據分發(Data Pump)
Replicat
數據應用
Collector
數據接收
主要文件:
Trail
數據的記錄
Checkpoints
數據檢查點信息
環境: CentOS 6.7/Oracle 11.2.0.4/GoldenGate 11.2.1.0.32
Step 1. 設置環境變量
export ORACLE_HOME=/u01/app/oracle/product/database/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
Step 2. 解壓縮軟件包
cd /u01/app/oracle/product/ogg/gghome/11.2.1/gghome_1
tar xf fbo_ggs_Linux_x64_ora11g_64bit.tar
Step 3. 安裝運行目錄
cd /u01/app/oracle/product/ogg/gghome/11.2.1/gghome_1
./ggsci
GGSCI> create subdirs
場景:源庫的表J.T1實時同步到目標庫的J.T1
Step 1. 源端OGG賬號配置
SQL> CREATE TABLESPACE GGS DATAFILE '+DATA01' SIZE 4G;
SQL> CREATE USER GGS IDENTIFIED BY GGS123 DEFAULT TABLESPACE GGS QUOTA UNLIMITED ON GGS;
SQL> GRANT DBA TO GGS;
$ ./keygen 128 1
0xD63ED81A1DA4DA0596004362410C5522
$ cat > ENCKEYS
DEFKEY 0xD63ED81A1DA4DA0596004362410C5522
GGSCI> encrypt password GGS123 encryptkey DEFKEY
Encrypted password: AADAAAAAAAAAAAGAJDSJTIIEHJJBOBPDNEZBYIAAPDOCCFGILFMAOGNCMCCAXABIQIFIJAXCKBLFQIMC
Algorithm used: AES128
Step 2. 源端數據庫配置
SQL> ALTER DATABASE FORCE LOGGING;
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
GGSCI> dblogin userid ggs, password AADAAAAAAAAAAAGAJDSJTIIEHJJBOBPDNEZBYIAAPDOCCFGILFMAOGNCMCCAXABIQIFIJAXCKBLFQIMC, encryptkey DEFKEY
GGSCI> add trandata J.T1
Step 3. 源端Manager進程配置
GGSCI> edit params MGR
PORT 7809
PURGEOLDEXTRACTS /data01/oracle/ogg/dirdat/ta*, USECHECKPOINTS, MINKEEPDAYS 30
AUTORESTART ER *, RETRIES 5, WAITMINUTES 1, RESETMINUTES 30
LAGREPORTMINUTES 30
LAGCRITICALMINUTES 60
GGSCI> start MGR
Step 4. 源端Extract進程配置
GGSCI> edit params EJT
EXTRACT EJT
SETENV (ORACLE_HOME="/u01/app/oracle/product/database/11.2.0/db_1")
SETENV (ORACLE_SID="stest")
USERID GGS, PASSWORD AADAAAAAAAAAAAGAJDSJTIIEHJJBOBPDNEZBYIAAPDOCCFGILFMAOGNCMCCAXABIQIFIJAXCKBLFQIMC, ENCRYPTKEY DEFKEY
TRANLOGOPTIONS DBLOGREADER, DBLOGREADERBUFSIZE 2097152
EXTTRAIL /data01/oracle/ogg/dirdat/ta
DISCARDFILE /u01/app/oracle/product/ogg/gghome/11.2.1/gghome_1/dirrpt/EJT.dsc, APPEND Megabytes 256
DISCARDROLLOVER AT 00:00 on SUNDAY
REPORTROLLOVER AT 00:00 on SUNDAY
REPORTCOUNT EVERY 4 HOURS, RATE
FETCHOPTIONS, FETCHPKUPDATECOLS, USESNAPSHOT, NOUSELATESTVERSION, MISSINGROW REPORT
STATOPTIONS REPORTFETCH
WARNLONGTRANS 1H, CHECKINTERVAL 5M
TABLE J.T1 ;
Step 5. 源端添加Extract進程
GGSCI> add extract EJT, tranlog, begin now
GGSCI> add exttrail /data01/oracle/ogg/dirdat/ta, extract EJT, megabytes 256
GGSCI> start extract EJT
Step 6. 目標端數據庫配置
SQL> ALTER SYSTEM SET enable_goldengate_replication=TRUE;
Step 7. 目標端OGG賬號配置
參見Step 1. 源端OGG賬號配置
Step 8. 目標端Checkpoint配置
GGSCI> dblogin userid ggs, password AADAAAAAAAAAAAGAJDSJTIIEHJJBOBPDNEZBYIAAPDOCCFGILFMAOGNCMCCAXABIQIFIJAXCKBLFQIMC, encryptkey DEFKEY
GGSCI> add checkpointtable ggs.checkpoint
Step 9. 目標端Manager進程配置
GGSCI> edit params ./GLOBALS
CHECKPOINTTABLE ggs.checkpoint
ALLOWOUTPUTDIR /data01/oracle/ogg/dirdat
GGSCI> edit params MGR
PORT 7809
PURGEOLDEXTRACTS /data01/oracle/ogg/dirdat/ta*, USECHECKPOINTS, MINKEEPDAYS 30
AUTORESTART ER *, RETRIES 5, WAITMINUTES 1, RESETMINUTES 30
LAGREPORTMINUTES 30
LAGCRITICALMINUTES 60
GGSCI> start MGR
Step 10. 源端Data Pump進程配置
GGSCI> edit params PJT
EXTRACT PJT
SETENV (ORACLE_HOME="/u01/app/oracle/product/database/11.2.0/db_1")
PASSTHRU
RMTHOST tj, MGRPORT 7809
RMTTRAIL /data01/oracle/ogg/dirdat/ta
DISCARDFILE /u01/app/oracle/product/ogg/gghome/11.2.1/gghome_1/dirrpt/PJT.dsc, APPEND, MEGABYTES 256
DISCARDROLLOVER AT 00:00 on SUNDAY
REPORTROLLOVER AT 00:00 on SUNDAY
REPORTCOUNT EVERY 4 HOURS, RATE
TABLE J.T1 ;
Step 11. 源端添加Data Pump進程
GGSCI> add extract PJT, exttrailsource /data01/oracle/ogg/dirdat/ta
GGSCI> add rmttrail /data01/oracle/ogg/dirdat/ta, extract PJT, megabytes 256
GGSCI> start extract PJT
Step 12. 目標端Replicat進程配置
GGSCI> edit params RJT
REPLICAT RJT
SETENV (ORACLE_HOME = "/u01/app/oracle/product/database/11.2.0/db_1" )
SETENV (ORACLE_SID="ttest")
SETENV (NLS_LANG = "AMERICAN_CHINA.ZHS16GBK")
USERID GGS, PASSWORD AADAAAAAAAAAAAGAJDSJTIIEHJJBOBPDNEZBYIAAPDOCCFGILFMAOGNCMCCAXABIQIFIJAXCKBLFQIMC, ENCRYPTKEY DEFKEY
DISCARDFILE /u01/app/oracle/product/ogg/gghome/11.2.1/gghome_1/dirrpt/RJT.dsc, APPEND Megabytes 256
DISCARDROLLOVER AT 00:00 on SUNDAY
REPORTROLLOVER AT 00:00 on SUNDAY
REPORTCOUNT EVERY 4 HOURS, RATE
ASSUMETARGETDEFS
MAP J.T1, TARGET J.T1;
Step 13. 目標端添加Replicat進程
GGSCI> dblogin userid ggs, password AADAAAAAAAAAAAGAJDSJTIIEHJJBOBPDNEZBYIAAPDOCCFGILFMAOGNCMCCAXABIQIFIJAXCKBLFQIMC, encryptkey DEFKEY
GGSCI> add replicat RJT, exttrail /data01/oracle/ogg/dirdat/ta
Step 14. 數據初始化-源端數據導出
SQL> SELECT CURRENT_SCN FROM V$DATABASE;
CURRENT_SCN
-------------
373926987
$ expdp system/systm123 directory=DUMPDIR dumpfile=JT1.dump tables=J.T1 flashback_scn=373926987 logfile=JT1.expdp.log
Step 15. 數據初始化-目標端數據導入
$ impdp system/systm123 directory=DUMPDIR dumpfile=JT1.dump logfile=JT1.impdp.log
Step 16. 目標端啟Replicat進程
GGSCI> start replicat RJT, atcsn 373926987
“GoldenGate的基本原理介紹”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。