共計 4196 個字符,預計需要花費 11 分鐘才能閱讀完成。
這篇文章將為大家詳細講解有關如何部署 goldengate,丸趣 TV 小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
一、安裝 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 open;
alter database force logging;
—- 取消用 alter database no force logging;
這下可以看一下歸檔是否已經起來,archive log list
1.5 開啟 minimal supplemental logging
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 創建 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
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;
關于“如何部署 goldengate”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。