Oracle GoldenGate 安装配置
Oracle GoldenGate软件可以实现异构平台数据的迁移和同步,它是基于数据库日志结构变化,通过解析源端在线日志或归档日志获得数据
Oracle GoldenGate软件可以实现异构平台数据的迁移和同步,它是基于数据库日志结构变化,通过解析源端在线日志或归档日志获得数据增量,再将这些变化应用到目标数据库,从而实现源库和目标库的数据同步。下面通过一个简单的示例,详细介绍利用GoldenGate实现Oracle数据库之间的同步。
1. 安装
1.1 下载介质
GoldenGate的安装介质可以从Oracle的官网上下载。
1.2 配置GoldenGate用户
下载完成后将其拷贝到源和目标的数据库的相应位置解压完成后,,即可以开始进行配置。
# su – oracle
$ mkdir /u01/ogg
$ cd /u01/ogg
$ tar xvf ogg_for_oracle_linux_86.tar
注意,如果使用Oracle 11g的数据库,需要创建一个link文件。
$ ln -s /u01/app/oracle/product/11.2.0/db_1/lib/libnnz11.so -
/u01/app/oracle/product/11.2.0/db_1/lib/libnnz10.so
配置环境变量
$ vi ~/.bash_profile
添加如下的内容:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/ogg
export GGATE=/u01/app/oracle/ogg
1.3 配置ogg的应用目录
使用ggsci工具,创建必要的目录。
$ cd /u01/app/oracle/ogg
$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x86, 32bit (optimized), Oracle 10 on Jul 28 2015 10:20:18
Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
GGSCI (gridcontrol) 1> create subdirs
至此,GoldenGate基本的安装完成。
注意:此部分需要在源端和目标端完成。
2. 源数据库配置
GoldenGate主要通过抓取源端数据库重做日志进行分析,将获取的数据应用到目标端,实现数据同步。因此,为了让GoldenGate能够正常工作,源数据库需要进行一定配置。
2.1配置源数据库必须是 归档模式、附加日志、强制日志
--查看
SQL> CONN / AS SYSDBA
SQL>select db.LOG_MODE, db.SUPPLEMENTAL_LOG_DATA_MIN, db.FORCE_LOGGING
from v$database db
SQL>--修改
SQL>--1)archivelog
SQL>shutdown immediate
SQL>startup mount
SQL>alter database archivelog;
SQL>alter database open;
SQL>--2)force logging
SQL>alter database force logging;
SQL>--3)supplemental log data
SQL>alter database add supplemental log data;
2.2 关闭数据库的recyblebin
SQL>alter system set recyclebin=off scope=spfile;
如果数据库是10g,需要关闭recyclebin并重启;或者手工purge recyclebin。
2.3 配置复制的DDL支持
SQL>create user ogg identified by ogg default tablespace users temporary tablespace temp;
SQL>grant connect,resource,unlimited tablespace to ogg;
SQL>grant execute on utl_file to ogg;
SQL>@$GGATE/marker_setup.sql;
SQL>@$GGATE/ddl_setup.sql;
SQL>@$GGATE/role_setup.sql;
SQL>grant GGS_GGSUSER_ROLE to ogg;
SQL>@$GGATE/ddl_enable.sql;
2.4创建源端和目标端的测试用户
--在源端执行
SQL>create user ss identified by oracle default tablespace users temporary tablespace temp;
SQL>grant connect,resource,unlimited tablespace to ss;
--在目标上执行
SQL>create user rr identified by oracle default tablespace users temporary tablespace temp;
SQL>grant connect,resource,unlimited tablespace to rr;
3. 配置manager
在源端和目标端分别执行下面的步骤。
3.1 源端创建manager
[ogg@node1 gg]$ ./ggsci
GGSCI (node1) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
GGSCI (node1) 2> edit params mgr
PORT 7809
GGSCI(node1) 3> start manager
Manager started.
在目标端
[ogg@node2 gg]$ ./ggsci
GGSCI (node2) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
GGSCI (node2) 2> edit params mgr
PORT 7809
GGSCI(node2) 3> start manager
Manager started.
4. 配置源端复制队列
GGSCI (node1) 1> add extract ext1, tranlog, begin now
EXTRACT added.
GGSCI (node1) 2> add exttrail /u01/ogg/dirdat/lt, extract ext1
EXTTRAIL added.
GGSCI (node1) 3> edit params ext1
extract ext1
userid , password ogg
rmthost node1, mgrport 7809
rmttrail /u01/ogg/dirdat/lt
ddl include mapped objname sender.*;
table sender.*;
GGSCI (node1) 6> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
EXTRACT STOPPED EXT1 00:00:00 00:10:55
5. 配置目标端同步队列
5.1 在目标端添加checkpoint表
[oracle@node2 ogg]$ ./ggsci
GGSCI (node2) 1> edit params ./GLOBAL –添加下列内容
GGSCHEMA ggate
CHECKPOINTTABLE ggate.checkpoint
GGSCI (node2) 2> dblogin userid ogg password ogg
Successfully logged into database.
GGSCI (node2) 3> add checkpointtable ogg.checkpoint
Successfully created checkpoint table GGATE.CHECKPOINT.

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values and pointers to data rows, and is suitable for non-primary key column queries.
