Oracle GoldenGate Install For Linux

 
 
Prepare(Source And Target DB):
 
useradd ogg -g oinstall

Add Environment Varible
vi /home/oracle/.bash_profile
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/ogg

Configure Database
alter database archivelog;
alter database force logging;
alter database add supplemental log data (primary key ,unique index) columns;

select SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_PK,
SUPPLEMENTAL_LOG_DATA_UI from v$database;

ALTER SYSTEM SET recyclebin = OFF scope=spfile; for Oracle 11g ,need to be restart


Create OGG User:
sqlplus / as sysdba
create user ogg identified by ogg;
grant dba to ogg;


GGSCI (zbdba1) 1> edit params ./GLOBAL
GGSCHEMA ogg
CHECKPOINTTABLE ogg.checkpoint

Installing the DDL objects:
1、Run the @marker_setup.sql script. This script installs support for the Oracle GoldenGate
marker system, which is required for DDL support. You will be prompted for the name
of the Oracle GoldenGate schema.
drop trigger ggs_ddl_trigger_before;
2、Run the @ddl_setup.sql script   Script that installs the Oracle GoldenGate DDL extraction and
replication objects. (Oracle installations)
3、Run the @role_setup.sql script. This script drops and creates the role needed for DDL
synchronization. It grants DML permissions on the Oracle GoldenGate DDL objects
4、Grant the role to all Oracle GoldenGate Extract users. You may need to make multiple
grants if the processes have different user names.
Run the @ddl_enable.sql script to enable the DDL trigger.
5、To improve the performance of the DDL trigger, make the ddl_pin script part of the database
startup. It must be invoked with the Oracle GoldenGate DDL user name, as in:
@?/rdbms/admin/dbmspool.sql
SQL> @ddl_pin ogg
To improve the performance of the DDL trigger 
This script pins the PL/SQL package that is used by the trigger into memory. If executing
this script from SQL*Plus, connect as SYSDBA from the Oracle GoldenGate home directory.
This script relies on the Oracle dmbs_shared_pool system package, so install that package
before using ddl_pin.


 
Source DB:
 
MANAGER
GGSCI (zbdba1) 1>  create subdirs

GGSCI (zbdba1) 22> view param mgr

port 7839
DYNAMICPORTLIST 7840-7914
USERID OGG,PASSWORD ogg
AUTORESTART EXTRACT *, RETRIES 5, WAITMINUTES 3
PURGEOLDEXTRACTS ./DIRDAT/*,MINKEEPDAYS 3
PURGEDDLHISTORY MINKEEPDAYS 7,MAXKEEPDAYS 10,FREQUENCYMINUTES 30
PURGEMARKERHISTORY MINKEEPDAYS 7,MAXKEEPDAYS 10
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
GGSCI (zbdba1) 3> dblogin userid ogg,password ogg;
Successfully logged into database.
GGSCI (zbdba1) 1> add trandata zbdba.*
 
EXTRACT
GGSCI (zbdba1) 1> dblogin userid ogg,password ogg

add extract ext1,tranlog, begin now
add exttrail /ogg/dirdat/sa  extract ext1.
add rmttrail ./dirdat/sa,extract ext1
GGSCI (zbdba1) 9> view param ext1

EXTRACT EXT1
setenv ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )
USERID ogg,PASSWORD ogg
DDL &
INCLUDE MAPPED OBJTYPE 'TABLE' &
INCLUDE MAPPED OBJTYPE 'IDNEX' &
INCLUDE MAPPED OBJTYPE 'SEQUENCE' &
INCLUDE MAPPED OBJTYPE 'VIEW' &
INCLUDE MAPPED OBJTYPE 'PROCEDURE' &
INCLUDE MAPPED OBJTYPE 'FUNCTION' &
INCLUDE MAPPED OBJTYPE 'PACKAGE' &
INCLUDE MAPPED OBJTYPE 'MATERIALIZED VIEW' &
EXCLUDE OPTYPE COMMENT
DDLOPTIONS ADDTRANDATA NOCROSSRENAME REPORT
REPORTCOUNT EVERY 1 MINUTES,RATE
DISCARDFILE ./dirrpt/EXTSA.DSC,APPEND,MEGABYTES 1024
THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 60000 IOLATENCY 60000
DBOPTIONS ALLOWUNUSEDCOLUMN
WARNLONGTRANS 2H,CHECKINTERVAL 3M
exttrail ./dirdat/sa
FETCHOPTIONS NOUSESNAPSHOT,FETCHPKUPDATECOLS,MISSINGROW REPORT
table zbdba.*;


datapump
GGSCI (zbdba1) 4>> add extract ext2,exttrailsource /ogg/dirdat/sa
EXTRACT added.

 ADD EXTTRAIL/RMTTRAIL ./dirdat/sa, EXTRACT EXT2

GGGSCI (zbdba1) 4> add rmttrail  /ogg/dirdat/sa, extract ext2
RMTTRAIL added.


GGSCI (zbdba1) 2>  view param ext2

EXTRACT EXT2
passthru
RMTHOST 192.168.56.61,MGRPORT 7839,COMPRESS
RMTTRAIL ./dirdat/sa
table zbdba.*;


 
 
 
Target DB:
 
GGSCI (zbdba2) 1>  create subdirs

GGSCI (zbdba2) 42> view param mgr

port 7839
DYNAMICPORTLIST 7840-7914
USERID OGG,PASSWORD ogg
AUTORESTART REPLICAT *, RETRIES 5, WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/*,MINKEEPDAYS 3
PURGEDDLHISTORY MINKEEPDAYS 7,MAXKEEPDAYS 10,FREQUENCYMINUTES 30
PURGEMARKERHISTORY MINKEEPDAYS 7,MAXKEEPDAYS 10
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45 


Create Replicat 
GGSCI (zbdba2) 1>  view param ./GLOBALS
GGSCHEMA ogg
CHECKPOINTTABLE ogg.checkpoint
GGSCI (zbdba2) 1> dblogin userid ogg,password ogg
GGSCI (zbdba2) 2> add checkpointtable  ogg.checkpoint

Successfully created checkpoint table OGG.CHECKPOINT.

GGSCI (zbdba2) 2>  add replicat rep1,exttrail /ogg/dirdat/sa, checkpointtable ogg.checkpoint
REPLICAT added.


GGSCI (zbdba2) 19> edit param rep1

REPLICAT rep1
ASSUMETARGETDEFS
USERID ogg, PASSWORD ogg
discardfile ./dirdat/rep1_discard.txt,append,megabytes 5
DDL INCLUDE MAPPED
DDLOPTIONS REPORT
BATCHSQL
DBOPTIONS DEFERREFCONST
DBOPTIONS LOBWRITESIZE 102400
HANDLECOLLISIONS
DDLERROR DEFAULT DISCARD RETRYOP MAXRETRIES 5 RETRYDELAY 20
--grouptransops 1
--maxtransops 1
APPLYNOOPUPDATES
MAP zbdba.*, TARGET zbdba.*;


start manager


GGSCI (zbdba2) 23> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                          
REPLICAT    STOPPED     REP1        00:00:00      00:00:03  


 
 
Test Data(Source and Target DB):
create tablepsace zbdab datafile '/opt/oracle/oradata/zbdba.dbf' size 100m;
create zbdba identified by oracle default tablespace zbdba;
grant dba to zbbda;
 
 
On Source DB:
 
User data pump:
expdp zbdba/oracle DIRECTORY=dumpdir
           DUMPFILE=zbdba.dmp LOGFILE=zbdba.log
           SCHEMAS=zbdba JOB_NAME=exp_zbdba_schema
 
 
scp data to target DB
 
 
On Target DB:
impdp zbdba/oracle DIRECTORY=dumpdir
           DUMPFILE=zbdba.dmp SCHEMAS=zbdba
           JOB_NAME=imp_zbdba_schema 
 

GGSCI (ogg2) 24> start rep1

Sending START request to MANAGER …
REPLICAT REP1 starting

 
GGSCI (ogg2) 26> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                          
REPLICAT    RUNNING     REP1        00:00:00      00:00:07  

 
 
On Source DB:

create table test as select * from dba_objects;

 
 
 
 
 
 
Monitor OGG(Source And Target DB):
tail -100f ggserr.log 
 
 
 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值