GoldenGate配置(二)之双向复制配置 环境: Item Source System Target System Platform Red Hat Enterprise Linux Server release 5.4 Red Hat Enterprise Linux Server release 5.4 Hostname gc1 gc2 Database Oracle 10.2.0.1 Oracle 11.2.0.1 Character
GoldenGate配置(二)之双向复制配置
环境:
Item |
Source System |
Target System |
Platform |
Red Hat Enterprise Linux Server release 5.4 |
Red Hat Enterprise Linux Server release 5.4 |
Hostname |
gc1 |
gc2 |
Database |
Oracle 10.2.0.1 |
Oracle 11.2.0.1 |
Character Set |
ZHS16GBK |
ZHS16GBK |
ORACLE_SID |
PROD |
EMREP |
Listener Name/Port |
LISTENER/1521 |
LISTENER/1521 |
Goldengate User |
ogg |
ogg |
双向复制配置
说明:此篇续接第一篇“GoldenGate配置(一)之单向复制配置”之后继续进行配置关于上一篇,GoldenGate配置(一)之单向复制配置:点击打开链接双向复制配置操作:
gc2:授权
SQL>grant CONNECT, RESOURCE to ogg;
SQL>grant CREATE SESSION, ALTER SESSION to ogg;
SQL>grant SELECT ANY DICTIONARY, SELECT ANY TABLE to ogg;
SQL>grant ALTER ANY TABLE to ogg;
SQL>grant FLASHBACK ANY TABLE to ogg;
SQL>grant EXECUTE on DBMS_FLASHBACK to ogg;
gc1:授权
SQL>grant CONNECT, RESOURCE to ogg;
SQL>grant CREATE SESSION, ALTER SESSION to ogg;
SQL>grant SELECT ANY DICTIONARY, SELECT ANY TABLE to ogg;
SQL>grant CREATE TABLE to ogg;
SQL>grant INSERT, UPDATE, DELETE on scott.tcustmer to ogg;--把需要同步表的DML操作授权给ogg
SQL>grant INSERT, UPDATE, DELETE on scott.tcustord to ogg;--把需要同步表的DML操作授权给ogg
gc2:开启补充日志
SQL>alter database add supplemental log data;
SQL>alter system switch logfile;
SQL>alter database force logging;
gc2:测试表添加到补充日志
GGSCI(gc2) 1> DBLOGIN USERID ogg, PASSWORD Ogg
Successfully logged into database.
GGSCI(gc2) 2> ADD TRANDATA scott.TCUSTMER
Logging of supplemental redo data enabled fortable SCOTT.TCUSTMER.
GGSCI(gc2) 3> ADD TRANDATA scott.TCUSTORD
Logging of supplemental redo data enabled fortable SCOTT.TCUSTORD.
gc2:配置Extract进程
GGSCI(gc2) 4> EDIT PARAMS EORA_1
-- Change Capture parameter file to capture
-- TCUSTMER and TCUSTORD changes
EXTRACT EORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD Ogg
TRANLOGOPTIONS EXCLUDEUSER ogg
EXTTRAIL ./dirdat/aa
TABLE scott.TCUSTMER;
TABLE scott.TCUSTORD;
~
~
"dirprm/eora_1.prm" [New] 9L, 257Cwritten
GGSCI(gc2) 5> ADD EXTRACT EORA_1, TRANLOG, BEGIN NOW
EXTRACT added.
GGSCI(gc2) 6> ADD EXTTRAIL ./dirdat/aa, EXTRACT EORA_1, MEGABYTES 5
EXTTRAIL added.
GGSCI(gc2) 7> START EXTRACT EORA_1
Sending START request to MANAGER ...
EXTRACT EORA_1 starting
GGSCI(gc2) 8> INFO EXTRACT EORA_1
EXTRACT EORA_1 Last Started 2014-06-1811:28 Status RUNNING
Checkpoint Lag 00:00:19 (updated 00:00:08 ago)
Log Read Checkpoint Oracle Redo Logs
2014-06-18 11:27:42 Seqno 6, RBA 35344
gc2:配置Pump进程
GGSCI(gc2) 9> EDIT PARAMS PORA_1
添加以下内容:
-- Data Pump parameter file to read thelocal
-- trail of TCUSTMER and TCUSTORDchanges
--
EXTRACT PORA_1
SETENV(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
PASSTHRU
RMTHOST gc1, MGRPORT 7809
RMTTRAIL ./dirdat/pa
TABLE scott.TCUSTMER;
TABLE scott.TCUSTORD;
~
~
~
"dirprm/pora_1.prm" [New] 10L, 250Cwritten
GGSCI(gc2) 10> ADD EXTRACT PORA_1, EXTTRAILSOURCE ./dirdat/aa
EXTRACT added.
GGSCI(gc2) 11> ADD RMTTRAIL ./dirdat/pa, EXTRACT PORA_1, MEGABYTES 5
RMTTRAIL added.
GGSCI(gc2) 12> START EXTRACT PORA_1
Sending START request to MANAGER ...
EXTRACT PORA_1 starting
gc1:配置Replicat进程
GGSCI(gc1) 1> EDIT PARAMS ./GLOBALS
CHECKPOINTTABLE ogg.ggschkpt
~
~
"./GLOBALS" [New] 1L, 29C written
GGSCI(gc1) 2> quit
[oracle@gc1ogg]$ ll GLOBALS --验证
-rw-rw-rw- 1 oracle oinstall 29 Jun 18 11:33GLOBALS
GGSCI(gc1) 1> DBLOGIN USERID ogg, PASSWORD Ogg
Successfully logged into database.
GGSCI(gc1) 2> ADD CHECKPOINTTABLE
No checkpoint table specified, using GLOBALSspecification (ogg.ggschkpt)...
Successfully created checkpoint tableOGG.GGSCHKPT.
gc1:配置Replicate进程
GGSCI(gc1) 3> EDIT PARAM RORA_1
--
-- Change Delivery parameter file to apply
-- TCUSTMER and TCUSTORD Changes
--
REPLICAT RORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD Ogg
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/RORA_aa.DSC, PURGE
MAP scott.tcustmer, TARGET scott.tcustmer;
MAP scott.tcustord, TARGET scott.tcustord;
~
~
"dirprm/rora_1.prm" [New] 12L, 327Cwritten
GGSCI(gc1) 4> ADD REPLICAT RORA_1, EXTTRAIL ./dirdat/pa
REPLICAT added.
GGSCI(gc1) 5> START REPLICAT RORA_1
Sending START request to MANAGER ...
REPLICAT RORA_1 starting
gc1:查看进程状态
GGSCI(gc1) 6> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EORA_1 00:00:00 00:00:08
EXTRACT RUNNING PORA_1 00:00:00 00:00:01
REPLICAT RUNNING RORA_1 00:00:00 00:00:06
gc2:查看进程状态
GGSCI(gc2) 13> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EORA_1 00:00:00 00:00:09
EXTRACT RUNNING PORA_1 00:00:00 00:00:06
REPLICAT RUNNING RORA_1 00:00:00 00:00:01
验证insert操作双向同步
gc1: gc1→gc2,DML操作:insert操作
SQL>insert into tcustmer VALUES('HYL','HUANG DBA.','HARBIN','CN');
1 row created.
SQL>commit;
Commit complete.
gc2:验证insert操作同步
SQL>select * from tcustmer;
CUST NAME CITY ST
---- -------------------------------------------------- --
HYL HUANGDBA. HARBIN CN
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO
gc2:gc2→gc1,DML操作:insert操作
SQL>insert into tcustmer VALUES('WT','WANGDBA.','QINGDAO','CN');
1 row created.
SQL>commit;
Commit complete.
gc1:gc1→gc2,DML操作:update操作
SQL>select * from tcustmer;
CUST NAME CITY ST
---- -------------------------------------------------- --
HYL HUANGDBA. HARBIN CN
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO
WT WANGDBA. QINGDAO CN
gc1:update操作
SQL>update tcustmer set city = 'BEIJING', state = 'CN' wherecust_code='HYL';
1 row updated.
SQL>commit;
Commit complete.
gc2:验证update操作同步
SQL>select * from tcustmer;
CUST NAME CITY ST
---- ------------------------------ ----------------------
HYL HUANGDBA. BEIJING CN
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO
WT WANGDBA. QINGDAO CN
gc2:gc2→gc1,DML操作:update操作
SQL>update tcustmer set city = 'BEIJING', state = 'CN' wherecust_code='WT';
1 row updated.
SQL>commit;
Commit complete.
gc1:验证update操作同步
SQL>select * from tcustmer;
CUST NAME CITY ST
---- -------------------------------------------------- --
HYL HUANGDBA. BEIJING CN
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO
WT WANGDBA. BEIJING CN
gc1:gc1→gc2,DML操作:delete操作
SQL>delete from tcustmer where CUST_CODE='WT';
1 row deleted.
SQL>commit;
Commit complete.
gc2:验证delete操作同步
SQL>select * from tcustmer;
CUST NAME CITY ST
---- -------------------------------------------------- --
HYL HUANGDBA. BEIJING CN
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO
gc2:gc2→gc1,DML操作:delete操作
SQL>delete from tcustmer where CUST_CODE='HYL';
1 row deleted.
SQL>commit;
Commit complete.
gc1:验证delete操作同步
SQL>select * from TCUSTMER;
CUST NAME CITY ST
---- -------------------------------------------------- --
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO
--至此,GoldenGate双向同步复制完成
声明:
原创作品,出自 “深蓝的blog” 博客,允许转载,转载时请务必注明出处(http://blog.csdn.net/huangyanlong)。
关于涉及版权事宜,作者有权追究法律责任。

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Chinese version
Chinese version, very easy to use

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version
Visual web development tools
