日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

ORACLE GOLDENGATE安裝配置

 wghbeyond 2013-05-30

Oracle GoldenGate軟件基于數(shù)據(jù)庫日志結(jié)構(gòu)變化,通過解析源端在線日志或歸檔日志獲得數(shù)據(jù)增量,再將這些變化應(yīng)用到目標(biāo)數(shù)據(jù)庫,從而實(shí)現(xiàn)源庫和目標(biāo)庫的數(shù)據(jù)同步。下面通過一個簡單的示例,詳細(xì)介紹利用GoldenGate實(shí)現(xiàn)Oracle數(shù)據(jù)庫之間的同步。

1. 安裝
1.1 下載介質(zhì)
GoldenGate的安裝介質(zhì)可以從Oracle的官網(wǎng)上下載。

http://www.oracle.com/technetwork/middleware/goldengate/overview/index.html

1.2 配置GoldenGate用戶
下載完成后將其拷貝到源和目標(biāo)的相應(yīng)位置解壓完成后,即可以開始進(jìn)行配置。
# su – oracle
$ mkdir /u01/ggate
$ cd /u01/ggate
$ tar xvf …….tar

注意,如果使用Oracle 11g的數(shù)據(jù)庫,需要創(chuàng)建一個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
添加如下的內(nèi)容:
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/ggate
export GGATE=/u01/app/oracle/ggate

1.3 創(chuàng)建目錄
使用ggsci工具,創(chuàng)建必要的目錄。

$ cd /u01/app/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 28 2010 13:24:18

Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.

GGSCI (gridcontrol) 1> create subdirs

至此,GoldenGate基本的安裝完成。
Note. 此部分需要在源端和目標(biāo)端完成。

2. 源數(shù)據(jù)庫配置
GoldenGate主要通過抓取源端數(shù)據(jù)庫重做日志進(jìn)行分析,將獲取的數(shù)據(jù)應(yīng)用到目標(biāo)端,實(shí)現(xiàn)數(shù)據(jù)同步。因此,為了讓GoldenGate能夠正常工作,源數(shù)據(jù)庫需要進(jìn)行一定配置。

2.1 歸檔模式、附加日志、強(qiáng)制日志

--查看
select db.LOG_MODE, db.SUPPLEMENTAL_LOG_DATA_MIN, db.FORCE_LOGGING
  from v$database db
--修改
--1)archivelog
shutdown immediate
startup mount
alter database archivelog;
alter database open;
--2)force logging
alter database force logging;
--3)supplemental log data
alter database add supplemental log data;

2.2 關(guān)閉數(shù)據(jù)庫的recyblebin
alter system set recyclebin=off scope=spfile;
如果數(shù)據(jù)庫是10g,需要關(guān)閉recyclebin并重啟;或者手工purge recyclebin。

2.3 配置復(fù)制的DDL支持

create user ggate identified by ggate default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to ggate;
grant execute on utl_file to ggate;
  
@$GGATE/marker_setup.sql;
@$GGATE/ddl_setup.sql;
@$GGATE/role_setup.sql;
grant GGS_GGSUSER_ROLE to ggate;
@$GGATE/ddl_enable.sql;

2.4 創(chuàng)建源端和目標(biāo)端的測試用戶

--source
create user sender identified by oracle default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to sender;
  
--destination
create user receiver identified by oracle default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to receiver;

3. 配置manager
在源端和目標(biāo)端分別執(zhí)行下面的步驟。

3.1 創(chuàng)建manager
[ggate@gridcontrol gg]$ ./ggsci
GGSCI (gridcontrol) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
GGSCI (gridcontrol) 2> edit params mgr
PORT 7809
ggate (gridcontrol) 3> start manager
Manager started.

4. 配置源端復(fù)制隊(duì)列
GGSCI (gridcontrol) 1> add extract ext1, tranlog, begin now
EXTRACT added.
GGSCI (gridcontrol) 2> add exttrail /u01/ggate/dirdat/lt, extract ext1
EXTTRAIL added.

GGSCI (gridcontrol) 3> edit params ext1
extract ext1
userid ggate@source, password oracle
rmthost centos4, mgrport 7809
rmttrail /u01/ggate/dirdat/lt
ddl include mapped objname sender.*;
table sender.*;

GGSCI (gridcontrol) 6> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
EXTRACT STOPPED EXT1 00:00:00 00:10:55

5. 配置目標(biāo)端同步隊(duì)列
5.1 在目標(biāo)端添加checkpoint表
[oracle@centos4 ggate]$ ./ggsci
GGSCI (centos4) 1> edit params ./GLOBAL –添加下列內(nèi)容
GGSCHEMA ggate
CHECKPOINTTABLE ggate.checkpoint
GGSCI (centos4) 2> dblogin userid ggate password ggate
Successfully logged into database.

GGSCI (centos4) 3> add checkpointtable ggate.checkpoint
Successfully created checkpoint table GGATE.CHECKPOINT.

5.2 創(chuàng)建同步隊(duì)列
GGSCI (centos4) 4> add replicat rep1, exttrail /u01/ggate/dirdat/lt, checkpointtable ggate.checkpoint
REPLICAT added.
GGSCI (centos4) 5> edit params rep1
replicat rep1
ASSUMETARGETDEFS
userid ggate,password ggate
discardfile /u01/ggate/dirdat/rep1_discard.txt, append, megabytes 10
DDL
map sender.*, target receiver.*;

6. 開啟同步
GGSCI (gridcontrol) 14> start extract ext1
GGSCI (gridcontrol) 15> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:00:05

GGSCI (centos4) 7> start replicat rep1
GGSCI (centos4) 8> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:00

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多