Oraclegoldengate 11g安裝

darren__chan發表於2015-03-18

安裝前準備工作

  Oracle OGG 11g安裝使用者和組設定

1.建立OGG作業系統使用者

這裡直接使用ORACLE使用者安裝GoldenGate,而不建立新使用者。

2.建立OGG資料庫使用者及授權

源端資料庫:

sqlplus / as sysdba

create user ggs identified by ggs default tablespace  ts_ogg temporary tablespace TEMP1 quota unlimited on ts_ogg;

grant CONNECT, RESOURCE to ggs;

grant CREATE SESSION, ALTER SESSION to ggs;

grant SELECT ANY DICTIONARY, SELECT ANY TABLE to ggs;

grant ALTER ANY TABLE to ggs;

grant FLASHBACK ANY TABLE to ggs;

grant EXECUTE on DBMS_FLASHBACK to ggs;

 

目標端資料庫:

 sqlplus / as sysdba

create user ggs identified by ggs default tablespace  ts_ogg temporary tablespace TEMP1 quota unlimited on  ts_ogg;

grant CONNECT, RESOURCE to ggs;

grant CREATE SESSION, ALTER SESSION to ggs;

grant SELECT ANY DICTIONARY, SELECT ANY TABLE to ggs;

grant CREATE TABLE to ggs;

 
?  資料庫啟用日誌功能

1.在源端資料庫啟用附件日誌

檢查是否開啟附加日誌:

SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;


如果沒有,使用以下命令開啟

SQL> alter database add supplemental log data;

SQL> alter system switch logfile;

 

2.在源端資料庫啟用歸檔。

啟用歸檔模式:

sqlplus / as sysdba

SQL> alter system set log_archive_dest='+FRA;

SQL> shutdown immediate

SQL> startup mount

SQL> alter database archivelog;

SQL> alter database open;

檢查資料庫歸檔資訊:

sqlplus / as sysdba

SQL> alter system archive log current;

SQL> archive log list;

3.在源端資料庫啟用強制日誌模式

檢查日誌模式:

SQL> SELECT force_logging FROM v$database;

FORCE_LOG

---------

NO

啟用強制日誌模式:

SQL> alter database force logging;

 

3)軟體安裝及配置

?  在源端和目標端系統建立安裝目錄並解壓安裝檔案

源端作業系統:

mkdir -p /home/oracle/ogg

cp ogg.zip  /home/oracle/ogg

cd  /home/oracle/ogg

unzip ogg.zip

tar –xvf ggs_AIX_x86_ora11g_64bit_v11_1_1_0_0_078.tar

目標端作業系統:

mkdir -p /home/oracle/ogg

cp ogg.zip  /home/oracle/ogg

cd  /home/oracle/ogg

unzip ogg.zip

tar –xvf ggs_AIX_x86_ora11g_64bit_v11_1_1_0_0_078.tar

?  為建立OGG子工作目錄

同時在源端和目標端系統執行:

[oracle@db] ./ggsci

 

GGSCI (db.cn.oracle.com) 1> create subdirs

 

Logging of supplemental redo log data is enabled for table SCOTT.DEPT_OGG

 

?  配置 Goldengate 管理程式

在源端和目標端系統配置 MGR

 [oracle@db ogg] ./ggsci

GGSCI (db.cn.oracle.com) 1> EDIT PARAMS MGR

 

PORT 7809

PURGEOLDEXTRACTS /dirdat, USECHECKPOINTS

 

GGSCI (db.cn.oracle.com) 2> START MGR

GGSCI (db.cn.oracle.com) 3> INFO MGR

 

?  配置 Goldengate 抽取程式

在源端系統配置 EXTRACT程式:

 [oracle@db ogg] ./ggsci

add extract ejj_cc4, tranlog,begin now

add exttrail ./dirdat/ag, extract ejc_cx4, megabytes 100

edit params ejj_cc4

配置內容示例:

extract ejj_cc4

SETENV (ORACLE_SID="orcl")

SETENV (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

Userid ggs,PASSWORD BBCLLLDEDDAIAUCOJGDDFPCCCHEGCPD, BLOWFISH, ENCRYPTKEY DEFAULT

REPORT AT 01:59

REPORTROLLOVER AT 02:00

CACHEMGR, CACHESIZE 256MB

EXTTRAIL ./dirdat/ag

NUMFILES 3000

EOFDELAYCSECS 30

GETTRUNCATES

TRANLOGOPTIONS DBLOGREADER

DYNAMICRESOLUTION

BR BRINTERVAL 2H , BRDIR BR

GETUPDATEBEFORES

NOCOMPRESSDELETES

WARNLONGTRANS 3H, CHECKINTERVAL 3M

table SCOTT.*;

table HR.WORK;

 

?  配置 Goldengate 投遞程式

在源端系統配置 EXTRACT程式:

 [oracle@db ogg] ./ggsci

add extract pjj_cc4,exttrailsource ./dirdat/ag

add rmttrail ./dirdat/bg, extract pjj_cc4, megabytes 500

edit params pjj_cc4

配置內容示例:

extract pjj_cc4

SETENV (ORACLE_SID="gdstjcpt1")

SETENV (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

Userid ggs,PASSWORD BBCLLLDEDDAIAUCOJGDDFPCCCHEGCPD, BLOWFISH, ENCRYPTKEY DEFAULT

REPORT AT 01:59

REPORTROLLOVER AT 02:00

CACHEMGR, CACHESIZE 256MB

FLUSHCSECS 30

NUMFILES 3000

EOFDELAYCSECS 30

RMTHOST 192.168.72.6,MGRPORT 7809, TCPBUFSIZE 100000, TCPFLUSHBYTES 300000

RMTTRAIL ./dirdat/bg

GETTRUNCATES

PASSTHRU

DYNAMICRESOLUTION

GETUPDATEBEFORES

NOCOMPRESSDELETES

table  SCOTT.*;

table HR.WORK;

 

?  配置 Goldengate 複製程式

在目標端系統新增checkpoint表:

GGSCI (grid.cn.oracle.com) 12> EDIT PARAMS ./GLOBALS

 

CHECKPOINTTABLE ggs.ggs_checkpoint

 

GGSCI (grid.cn.oracle.com) 1> DBLOGIN USERID ogg, PASSWORD ogg

Successfully logged into database.

 

GGSCI (grid.cn.oracle.com) 2> ADD CHECKPOINTTABLE

No checkpoint table specified, using GLOBALS specification (ggs.ggs_checkpoint...

Successfully created checkpoint table OGG.GGSCHKPT.

 

在目標端系統配置 REPLIC程式:

 [oracle@db ogg] ./ggsci

dblogin userid ggs,password register

add replicat rjj_cc4,exttrail ./dirdat/bg, checkpointtable ggs.ggs_checkpoint

edit params rjj_cc4

配置內容示例:

replicat rjj_cc4

SETENV (ORACLE_SID="orcl")

SETENV (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

Userid ggs,PASSWORD ogg

REPORT AT 01:59

REPORTROLLOVER AT 02:00

CACHEMGR, CACHESIZE 256MB

REPERROR DEFAULT,ABEND

DISCARDFILE ./dirrpt/rjc_cx4.dsc,APPEND,MEGABYTES 100

DISCARDROLLOVER AT 06:00

GETTRUNCATES

NUMFILES 3000

EOFDELAYCSECS 30

ASSUMETARGETDEFS

ALLOWNOOPUPDATES

DYNAMICRESOLUTION

GETUPDATEBEFORES

NOCOMPRESSDELETES

MAP SCOTT.*, TARGET SCOTT.*;

MAP HR.WORK, TARGET  HR.WORK;

 

?  為表新增附加日誌

在源端系統新增:

GGSCI (db.cn.oracle.com) 3> DBLOGIN USERID ogg, PASSWORD Ogg

Successfully logged into database.

新增示例:

GGSCI (db.cn.oracle.com) 5> ADD TRANDATA scott.EMP_OGG

Logging of supplemental redo data enabled for table SCOTT.EMP_OGG.

 

GGSCI (db.cn.oracle.com) 6> ADD TRANDATA scott.DEPT_OGG

Logging of supplemental redo data enabled for table SCOTT.DEPT_OGG.

Verify that supplemental logging has been turned on for these tables.

GGSCI (cdcjp63vm3.cn.oracle.com) 7> INFO TRANDATA scott.emp*

Logging of supplemental redo log data is enabled for table SCOTT.EMP_OGG

Logging of supplemental redo log data is enabled for table SCOTT.DEPT_OGG

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29863023/viewspace-1465182/,如需轉載,請註明出處,否則將追究法律責任。

相關文章