gg_install_first

installation of goldengate for unix
1 设置环境变量
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/OraHome
export ORACLE_SID=ggsource
export ORACLE_OWNER=oracle
export ORACLE_TERM=vt100
# export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
export PATH=$ORACLE_HOME/bin:$ORACLE_BASE/gg11:$PATH=$PATH:$HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_BASE/gg11

2 创建目录
[oracle@ggsource oracle]$ mkdir gg11
3 extract the files
[oracle@ggsource ~]$ unzip V26188-01.zip
[oracle@ggsource ~]$ mv fbo_ggs_Linux_x86_ora11g_32bit.tar  /u01/oracle/gg11
[oracle@ggsource gg11]$tar -xvof fbo_ggs_Linux_x86_ora11g_32bit.tar
4  进入相关的目录
[oracle@ggsource gg11]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1 OGGCORE_11.1.1_PLATFORMS_110421.2040
Linux, x86, 32bit (optimized), Oracle 11g on Apr 21 2011 22:38:06
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
GGSCI (ggsource) 1>
5 创建目录
GGSCI (ggsource) 1> create subdirs
Creating subdirectories under current directory /u01/oracle/gg11
6 把数据库设置为归档模式
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5
Current log sequence           7
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area  422670336 bytes
Fixed Size                  1336960 bytes
Variable Size             272632192 bytes
Database Buffers          142606336 bytes
Redo Buffers                6094848 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter system set log_archive_dest_1='location=/u01/oracle/archive' scope=both;
System altered.
SQL> alter database open;
Database altered.
7 Oracle-specific installation steps (source)
SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;
SUPPLEME
--------
NO
SQL> alter database add supplemental log data;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;
SUPPLEME
--------
YES
8 创建用户
以上8步都是源端与目标端都要配置的步骤
 
9 Add supplemental logging(source)
GGSCI (ggsource) 1> dblogin userid gguser,password qilin
Successfully logged into database.
GGSCI (ggsource) 2> add trandata gguser.tcustmer
Logging of supplemental redo data enabled for table GGUSER.TCUSTMER.
GGSCI (ggsource) 3> add trandata scott.tcustord
Logging of supplemental redo data enabled for table GGUSER.TCUSTORD.
GGSCI (ggsource) 3> info trandata gguser.*
10 分别在源端与目标端配置MGR,且端口要相同
GGSCI (ggsource) 34> view params mgr
port 7809
GGSCI (ggtarget) 82> view params mgr
PORT 7809
第一部分 在源端的配置(initial load)
1 Add the initial load capture batch task group
GGSCI (ggsource) 2> add extract einiyu,sourceistable
EXTRACT added.
2
GGSCI (ggsource) 23> info extract *, tasks
EXTRACT    EINIYU    Last Started 2012-05-11 14:10   Status STOPPED
Checkpoint Lag       Not Available
Log Read Checkpoint  Table GGUSER.TCUSTORD
                     2012-05-11 14:10:52  Record 2
Task                 SOURCEISTABLE
EXTRACT    EINTQI    Initialized   2012-05-08 17:46   Status STOPPED
Checkpoint Lag       Not Available
Log Read Checkpoint  Not Available
                     First Record         Record 0
Task                 SOURCEISTABLE
3
GGSCI (ggsource) 4> edit params einiyu
extract einiyu
userid gguser,password qilin
rmthost 192.168.189.49,mgrport 7809
rmttask replicat,group rinisu
table gguser.tcustmer;
table gguser.tcustord;
 
GGSCI (ggsource) 24> view params einiyu
extract einiyu
userid gguser,password qilin
rmthost 192.168.189.49,mgrport 7809
rmttask replicat,group rinisu
table gguser.tcustmer;
table gguser.tcustord;

GGSCI (ggsource) 26> start extract einiyu
Sending START request to MANAGER ...
EXTRACT EINIYU starting
第二部分 在源端的配置(change capture)
1
ADD EXTRACT EORAkk, TRANLOG, BEGIN NOW, THREADS 1
2
GGSCI (ggsource) 27> info extract *
EXTRACT    EORAKK    Last Started 2012-05-11 14:48   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint  Oracle Redo Logs
                     2012-05-11 15:13:08  Thread 1, Seqno 18, RBA 6165008
3
GGSCI (ggsource) 28> edit params eorakk

EXTRACT EORAkk
USERID gguser, PASSWORD qilin
RMTHOST 192.168.189.49, MGRPORT 7809
RMTTRAIL ./dirdat/kk
TABLE gguser.TCUSTMER;
TABLE gguser.TCUSTORD;
4
GGSCI> ADD RMTTRAIL ./dirdat/kk, EXTRACT EORAkk, MEGABYTES 5
5
GGSCI (ggsource) 29> info rmttrail *
       Extract Trail: ./dirdat/kk
             Extract: EORAKK
               Seqno: 0
                 RBA: 3027
           File Size: 5M
6
GGSCI (ggsource) 31> start extract eorakk
7
GGSCI (ggsource) 30> info all
Program     Status      Group       Lag           Time Since Chkpt
MANAGER     RUNNING                                          
EXTRACT     RUNNING     EORAKK      00:00:00      00:00:01
8
GGSCI (ggsource) 31> info extract eorakk, detail
EXTRACT    EORAKK    Last Started 2012-05-11 14:48   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:03 ago)
Log Read Checkpoint  Oracle Redo Logs
                     2012-05-11 15:16:14  Thread 1, Seqno 18, RBA 6203904
  Target Extract Trails:
  Remote Trail Name                                Seqno        RBA     Max MB
  ./dirdat/kk                                          0       3027          5
  Extract Source                          Begin             End            
  /u01/oracle/oradata/ggsource/redo03.log  2012-05-11 14:28  2012-05-11 15:16
  Not Available                           * Initialized *   2012-05-11 14:28

Current directory    /u01/oracle/gg11
Report file          /u01/oracle/gg11/dirrpt/EORAKK.rpt
Parameter file       /u01/oracle/gg11/dirprm/eorakk.prm
Checkpoint file      /u01/oracle/gg11/dirchk/EORAKK.cpe
Process file         /u01/oracle/gg11/dirpcs/EORAKK.pce
Stdout file          /u01/oracle/gg11/dirout/EORAKK.out
Error log            /u01/oracle/gg11/ggserr.log
9
GGSCI (ggsource) 32>view report eroakk
10
GGSCI (ggsource) 32> info all
Program     Status      Group       Lag           Time Since Chkpt
MANAGER     RUNNING                                          
EXTRACT     RUNNING     EORAKK      00:00:00      00:00:09 
11 在源数据库端的表中插入数据
SQL> conn gguser/qilin
Connected.
SQL> @demo_ora_misc.sql
12 查询 
SQL> select * from TCUSTMER;
CUST NAME                           CITY                 ST
---- ------------------------------ -------------------- --
DAVE DAVE'S PLANES INC.             TALLAHASSEE          FL
BILL BILL'S USED CARS               DENVER               CO
ANN  ANN'S BOATS                    NEW YORK             NY
WILL BG SOFTWARE CO.                SEATTLE              WA
JANE ROCKY FLYER INC.               DENVER               CO
第一部分 在目标端的部署(initial load)
1
GGSCI (ggtarget) 2> add replicat einisu,specialrun
2
GGSCI (ggtarget) 70> info replicat *,task
REPLICAT   EINTQI    Initialized   2012-05-09 15:52   Status STOPPED
Checkpoint Lag       00:00:00 (updated 47:10:41 ago)
Log Read Checkpoint  Not Available
Task                 SPECIALRUN
REPLICAT   RINISU    Initialized   2012-05-10 15:38   Status STOPPED
Checkpoint Lag       00:00:00 (updated 23:24:02 ago)
Log Read Checkpoint  Not Available
Task                 SPECIALRUN
3
GGSCI (ggtarget) 73> edit params rinisu
replicat rinisu
assumetargetdefs
userid gguser, password qilin
discardfile ./dirrpt/rinisu.dsc,purge
map gguser.*, target gguser.*;
~
4
GGSCI (ggtarget) 76> view params rinisu
replicat rinisu
assumetargetdefs
userid gguser, password qilin
discardfile ./dirrpt/rinisu.dsc,purge
map gguser.*, target gguser.*;
5
GGSCI (ggtarget) 77> view report rinisu
6 验证结果
select * from tcustmer;

第二部分 在目标端的配置(change capture)
1
GGSCI (ggtarget) 77> edit params ./globals

checkpointtable gguser.ckeckpoint
2
GGSCI (ggtarget) 78> dblogin userid gguser, password qilin
Successfully logged into database.
3
GGSCI> ADD CHECKPOINTTABLE  gguser.checkpoint
4
SQL> select object_name from user_objects;
5
add replicat rorakk,exttrail ./dirdat/kk
add replicat rorakk,exttrail ./dirdat/kk  checkpointtable gguser.checkpoint
6
GGSCI (ggtarget) 79> edit params rorakk

replicat rorakk
userid gguser, password qilin
handlecollisions
assumetargetdefs
discardfile ./dirrpt/rorakk.dsc purge
map gguser.tcustmer, target gguser.tcustmer;
map gguser.tcustord, target gguser.tcustord;
7
start replicat rorakk
8
GGSCI (ggtarget) 80> info replicat *
REPLICAT   RORAKK    Last Started 2012-05-11 14:05   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:09 ago)
Log Read Checkpoint  File ./dirdat/kk000000
                     2012-05-11 14:50:15.020496  RBA 3027
9
GGSCI (ggtarget) 81> info all
Program     Status      Group       Lag           Time Since Chkpt
MANAGER     RUNNING                                          
REPLICAT    RUNNING     RORAKK      00:00:00      00:00:01 
10 验证结果
SQL> select * from TCUSTMER;
CUST NAME                           CITY                 ST
---- ------------------------------ -------------------- --
DAVE DAVE'S PLANES INC.             TALLAHASSEE          FL
BILL BILL'S USED CARS               DENVER               CO
ANN  ANN'S BOATS                    NEW YORK             NY
WILL BG SOFTWARE CO.                SEATTLE              WA
JANE ROCKY FLYER INC.               DENVER               CO

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20976446/viewspace-723361/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/20976446/viewspace-723361/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值