Oracle GoldenGate软件基于数据库日志结构变化,通过解析源端在线日志或归档日志获得数据增量,再将这些变化应用到目标数据库,从
Oracle GoldenGate软件基于数据库日志结构变化,通过解析源端在线日志或归档日志获得数据增量,再将这些变化应用到目标数据库,从而实现源库和目标库的数据同步。下面通过一个简单的示例,详细介绍利用GoldenGate实现Oracle数据库之间的同步。基本架构如下图所示:
1. 安装
1.1 下载介质
GoldenGate的安装介质可以从Oracle的官网上下载。
1.2 配置GoldenGate用户
下载完成后将其拷贝到源和目标的相应位置解压完成后,即可以开始进行配置。
# useradd -g oinstall -G dba ggate
# su – ggate
$ mkdir /oracle/ggate
$ cd /oracle/ggate
$ unzip ……
$tar ……
$ vi ~/.bash_profile
添加如下的内容:
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/db
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/oracle/ggate
export GGATE=/oracle/ggate
1.3 创建目录
使用ggsci工具,创建必要的目录。
$ cd /oracle/ggate
$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x86, 32bit (optimized), Oracle 10 on Jul 282010 13:24:18
Copyright (C) 1995, 2010, Oracle and/or itsaffiliates. All rights reserved.
GGSCI (gridcontrol) 1> create subdirs
至此,GoldenGate基本的安装完成。
注意: 此部分需要在源端和目标端完成。
2. 源数据库配置
GoldenGate主要通过抓取源端数据库重做日志进行分析,将获取的数据应用到目标端,实现数据同步。因此,为了让GoldenGate能够正常工作,源数据库需要进行一定配置。
2.1 设置源库为归档模式
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
2.2 开启minimal supplemental logging
SQL> alter database add supplemental log data;
SQL> select SUPPLEMENTAL_LOG_DATA_MIN fromv$database;
SUPPLEME
——–
YES
2.3 关闭数据库的recyblebin
SQL> alter system set recyclebin=off scope=spfile;
如果数据库是10g,,需要关闭recyclebin并重启;或者手工purge recyclebin。
2.4 配置复制的DDL支持
SQL> create user ggate identified by ggate defaulttablespace users temporary tablespace temp;
SQL> grant connect,resource,dba,unlimitedtablespace to ggate;
SQL> grant execute on utl_file to ggate;
SQL> @$GGATE/marker_setup.sql;
SQL> @$GGATE/ddl_setup.sql;
SQL> @$GGATE/role_setup.sql;
SQL> grant GGS_GGSUSER_ROLE to ggate;
SQL> @$GGATE/ddl_enable.sql;
2.5 创建源端和目标端的测试用户
source
SQL> create user sender identified by oracledefault tablespace users temporary tablespace temp;
SQL> grant connect,resource,unlimited tablespace tosender;
destination
SQL> create user ggate identified by ggate defaulttablespace users temporary tablespace temp;
SQL> grant connect,resource,dba,unlimitedtablespace to ggate;
SQL> create user receiver identified by oracledefault tablespace users temporary tablespace temp;
SQL> grant connect,resource,unlimited tablespace toreceiver;

MySQLoffersvariousstorageengines,eachsuitedfordifferentusecases:1)InnoDBisidealforapplicationsneedingACIDcomplianceandhighconcurrency,supportingtransactionsandforeignkeys.2)MyISAMisbestforread-heavyworkloads,lackingtransactionsupport.3)Memoryengineis

Common security vulnerabilities in MySQL include SQL injection, weak passwords, improper permission configuration, and unupdated software. 1. SQL injection can be prevented by using preprocessing statements. 2. Weak passwords can be avoided by forcibly using strong password strategies. 3. Improper permission configuration can be resolved through regular review and adjustment of user permissions. 4. Unupdated software can be patched by regularly checking and updating the MySQL version.

Identifying slow queries in MySQL can be achieved by enabling slow query logs and setting thresholds. 1. Enable slow query logs and set thresholds. 2. View and analyze slow query log files, and use tools such as mysqldumpslow or pt-query-digest for in-depth analysis. 3. Optimizing slow queries can be achieved through index optimization, query rewriting and avoiding the use of SELECT*.

To monitor the health and performance of MySQL servers, you should pay attention to system health, performance metrics and query execution. 1) Monitor system health: Use top, htop or SHOWGLOBALSTATUS commands to view CPU, memory, disk I/O and network activities. 2) Track performance indicators: monitor key indicators such as query number per second, average query time and cache hit rate. 3) Ensure query execution optimization: Enable slow query logs, record and optimize queries whose execution time exceeds the set threshold.

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

MySQL uses a GPL license. 1) The GPL license allows the free use, modification and distribution of MySQL, but the modified distribution must comply with GPL. 2) Commercial licenses can avoid public modifications and are suitable for commercial applications that require confidentiality.

The situations when choosing InnoDB instead of MyISAM include: 1) transaction support, 2) high concurrency environment, 3) high data consistency; conversely, the situation when choosing MyISAM includes: 1) mainly read operations, 2) no transaction support is required. InnoDB is suitable for applications that require high data consistency and transaction processing, such as e-commerce platforms, while MyISAM is suitable for read-intensive and transaction-free applications such as blog systems.

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.


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

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version
Recommended: Win version, supports code prompts!

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
