【轉】GoldenGate資料庫複製實施案例
實驗環境:oracle10g+redhat4+goldengate
一、安裝redhat4,安裝步驟略
二、安裝oracle10g 安裝步驟略
三、安裝goldengate,注意要選對版本
1、源端安裝配置
1.1安裝goldengate
linux: mkdir /u01/oracle/ggate
cd /u01/oracle/ggate
通過ftp,將goldengate的zip軟體上傳到/u01/oracle/ggate
unzip 解壓,將生成一個tar檔案
tar -xvf *.tar
1.2配置.bash_profile
vi .bash_profile
新增:
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/oracle/ggate
export GGATE_HOME=/u01/oracle/ggate
注意LD_LIBRARY_PATH,那一行,可以在原來安裝oracle的基礎上新增在後面便可
配置完,執行 source ~./bash_profile
1.3建立goldengate目錄
cd /u01/oracle/ggate
./ggsci (進入goldengate命令列介面)
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
現在在goldengate命令列工作
create subdirs
1.4配置資料庫歸檔模式,進入sql命令列(如果關閉,建議開啟)
sqlplus "/as sysdba"
alter system set log_archive_format='%s_%t_%r.log' scope=spfile;
alter system set log_archive_dest_1='location=/u02/oracle/arc';
shutdown immediate;
startup mount;
alter database archivelog;
開啟強制日誌模式:alter database force logging;
alter database open;
這下可以看一下歸檔是否已經起來,archive log list
1.5開啟minimal supplemental logging
--alter database add supplemental log data;這種設定是許多文件介紹的,但是對於非主鍵或唯一索引表的會有問題,在測試過程中,發覺update會報錯,可能其它地方沒搞好!
alter database add supplemental log data(primary key,unique) columns;這是我的配置!
1.6關閉回收站
alter system set recyclebin=off scope=spfile;
1.7配置複製的DDL支援
建立使用者授權:
create user ggate identified by ggate default tablespace users temporary tablespace temp quota unlimited on users;
grant connect,resource,dba to ggate;
grant execute on utl_file to ggate;
grant restricted session to ggate;
@$GGATE_HOME/marker_setup.sql;
SCHEMA:GGATE
@$GGATE_HOME/ddl_setup.sql;
這裡要看清楚,選擇輸入,否則會有問題!
@$GGATE_HOME/role_setup.sql;
授予角色權力:
grant GGS_GGSUSER_ROLE to ggate;
@$GGATE_HOME/ddl_enable.sql;
1.8建立源端使用者(用於同步的使用者)
create user sender identified by ggate default tablespace users temporary tablespace temp quota unlimited on users;
grant dba,connect,resource to ggate;
grant select on v_$session to ggate;
2、源端複製佇列配置
2.1配置manager
cd /u01/oracle/ggate
./ggsci (進入goldengate命令列)
edit params mgr
輸入:PORT 7809
與vi操作基本相同
2.2配置源端複製佇列
同樣是在goldengate命令列裡做
add extract ext1, tranlog, begin now
add exttrail /u01/oracle/ggate/dirdat/lt, extract ext1
edit params ext1
輸入如下內容:
extract ext1
userid ggate, password ggate
rmthost 目標機, mgrport 7809
rmttrail /u01/oracle/ggate/dirdat/lt
ddl include mapped objname sender.*;
table sender.*;
到這裡,可以用info all檢視一下,
關閉程式:
stop mgr
stop ext1
到這裡源端基本上配置完畢
3、目標端安裝配置
3.1安裝goldengate
linux: mkdir /u01/oracle/ggate
cd /u01/oracle/ggate
通過ftp,將goldengate的zip軟體上傳到/u01/oracle/ggate
unzip 解壓,將生成一個tar檔案
tar -xvf *.tar
3.2配置.bash_profile
vi .bash_profile
新增:
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/oracle/ggate
export GGATE_HOME=/u01/oracle/ggate
注意LD_LIBRARY_PATH,那一行,可以在原來安裝oracle的基礎上新增在後面便可
配置完,執行 source ~./bash_profile
3.3
cd /u01/oracle/ggate
./ggsci (進入goldengate命令列介面)
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
現在在goldengate命令列工作
create subdirs
3.4
create user ggate identified by ggate default tablespace users temporary tablespace temp quota unlimited on users;
create user receiver identified by ggate default tablespace users temporary tablespace temp quota unlimited on users;(接收同步的使用者)
grant connect,resource,dba to ggate;
grant execute on utl_file to ggate;
grant restricted session to ggate;
grant connect,resource,dba to receiver;
grant select on v_$session to receiver;
3.5配置replicat
./ggsci
edit params ./GLOBALS
輸入:
GGSCHEMA ggate
CHECKPOINTTABLE ggate.checkpoint
edit params mgr
輸入:PORT 7809
在goldengate命令列登入資料庫
dblogin userid ggate,password ggate
add checkpointtable ggate.checkpoint (增加檢測點)
add replicat rep1, exttrail /u01/oracle/ggate/dirdat/lt, checkpointtable ggate.checkpoint(增加同不佇列)
edit params rep1
新增如下內容:
replicat rep1
ASSUMETARGETDEFS
userid ggate, password ggate
discardfile /u01/oracle/ggate/dirdat/rep1_discard.txt, append, megabytes 10
DDL include all
map sender.*, target receiver.*;
到這裡上標端配置基本結束
四、額外增加的一個步驟,我是這樣做
分別在源端、目標端增加
mkdir -p /u01/oracle/ggate/dirdat/lt
五、在goldengate命令列開啟
源端:start manager
start ext1
目標:start manager
start rep1
六、測試:
源端:create table sender.test(empid number(4),names varchar2(10),oldage number(3));
目標:select * from receiver.test;
七、其它的一些錯誤查詢等,去搜集相關資料
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26686207/viewspace-735889/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- GoldenGate schema級複製 實施過程Go
- 資料複製_GoldenGateGo
- goldengate部署實施案例Go
- GoldenGate異種資料庫之間的複製Go資料庫
- ORACLE SQL Developer4資料庫複製案例OracleSQLDeveloper資料庫
- 在Oracle中實現資料庫的複製(轉)Oracle資料庫
- MongoDB資料庫之主從複製配置實戰【轉】MongoDB資料庫
- oracle實驗-資料庫複製Oracle資料庫
- 資料庫複製資料庫
- 複製資料庫資料庫
- mysql 資料表的複製案例MySql
- 資料庫複製(一)–複製介紹資料庫
- DM7資料複製之資料庫級複製資料庫
- Duplicate 複製資料庫實驗過程資料庫
- mysql資料庫實現主從複製MySql資料庫
- 直接複製資料檔案實現linux平臺資料庫複製到windows平臺資料庫Linux資料庫Windows
- 網路資料庫的複製和同步(轉)資料庫
- mysql資料庫的主從複製和主主複製實踐MySql資料庫
- EOFDELAYCSECS GOLDENGATE提升複製實時性Go
- 資料庫主從複製資料庫
- Oracle活動資料庫複製Oracle資料庫
- RMAN複製資料庫(十)資料庫
- RMAN複製資料庫(九)資料庫
- RMAN複製資料庫(八)資料庫
- RMAN複製資料庫(七)資料庫
- RMAN複製資料庫(六)資料庫
- RMAN複製資料庫(五)資料庫
- RMAN複製資料庫(四)資料庫
- RMAN複製資料庫(三)資料庫
- RMAN複製資料庫(二)資料庫
- RMAN複製資料庫(一)資料庫
- 使用RMAN複製資料庫資料庫
- 使用OEM複製資料庫資料庫
- 複製和資料庫映象資料庫
- 手動複製資料庫資料庫
- oracle rman複製資料庫Oracle資料庫
- 複製資料庫步驟資料庫
- 在Oracle中實現資料庫的複製Oracle資料庫