Oracle Linux 5.7 部署ogg v11 oracle to oracle

版本信息:

os:Enterprise Linux Enterprise Linux Server release 5.7

db:Release 10.2.0.1.0

ogg:Version 11.2.1.0.1

事前准备(两个节点都要准备):

1,安装好Oracle并启动,上传ogg安装介质到/ogg并解压

2,创建ggusr表空间,创建ggusr用户并授权

创建表空间

SQL> create tablespace ggusr datafile '/s01/oradata/prod1/ggusr01.dbf' size 1000M autoextend on;

创建用户

SQL> create user ggusr identified by ggusr default tablespace ggusr;

授权

SQL> grant connect,resource to ggusr;

SQL> grant create session,alter session to ggusr;
SQL> grant select any dictionary ,select any table to ggusr;

SQL> grant flashback any table to ggusr;

SQL> grant dba to ggusr;

在这里将测试用户也一起创建:

SQL> create user ggtest identified by ggtest;

SQL> grant connect, resource to ggtest;

3,修改oracle环境变量

本例中打算使用oracle用户对ogg进行安装,要修改oracle的.bash_profile文件

ORACLE_BASE=/s01
ORACLE_HOME=/s01/oracle/app/product/db_1
ORA_CRS_HOME=/s01/oracle/app/product/crs_1
ORACLE_SID=prod1
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/ogg
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/ogg:$LD_LIBRARY_PATH -------红色部分为要添加的内容,/ogg 为ogg的安装目录
export PATH ORACLE_BASE ORACLE_HOME ORA_CRS_HOME ORACLE_SID LD_LIBRARY_PATH

4,安装ogg软件

[oracle@ogg1 media]$ unzip ogg112101_fbo_ggs_Linux_x86_ora11g_32bit.zip

[oracle@ogg1 ogg]$ tar -xvof media/fbo_ggs_Linux_x86_ora11g_32bit.tar

 

[oracle@ogg1 ogg]$ ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x86, 32bit (optimized), Oracle 10g on Apr 23 2012 07:06:02

Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.

 

GGSCI (ogg1) 1> create subdirs

Creating subdirectories under current directory /ogg

Parameter files /ogg/dirprm: already exists
Report files /ogg/dirrpt: created
Checkpoint files /ogg/dirchk: created
Process status files /ogg/dirpcs: created
SQL script files /ogg/dirsql: created
Database definitions files /ogg/dirdef: created
Extract data files /ogg/dirdat: created
Temporary files /ogg/dirtmp: created
Stdout files /ogg/dirout: created

关于oracle的特定配置(只需在source端操作)

1,数据库级别开启supplemental logging

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

SQL> ALTER SYSTEM SWITCH LOGFILE;

配置ogg(oracle to oracle)

配置的整体规划如下图:

Oracle Linux 5.7 部署ogg v11 oracle to oracle 

1,初始数据导入配置

数据的初始化有很多种方式,比如exp/imp,backup/restore等,这里图示ogg的初始化方式。

Oracle Linux 5.7 部署ogg v11 oracle to oracle 

Configure Change Capture(在source端进行)

Configure the Manager process on the source

[oracle@ogg1 ogg]$ ggsci
GGSCI> EDIT PARAMS MGR

在文件中输入下面内容并保存:

port 7809
启动mgr:

GGSCI (ogg1) 4> start mgr

Manager started.

查看mgr信息:
GGSCI (ogg1) 5> info mgr

Manager is running (IP port ogg1.7809).

Create the source tables and load the initial data.

Shell> cd <install location>
Shell> sqlplus ggtest/ggtest
SQL> @demo_ora_create

SQL> @demo_ora_insert
Verify the results:
SQL> select * from tcustmer;
SQL> select * from tcustord;
SQL> exit

Add supplemental logging

GGSCI> DBLOGIN USERID ggusr, PASSWORD ggusr

GGSCI> ADD TRANDATA ggtest.TCUSTMER
GGSCI> ADD TRANDATA ggtest.TCUSTORD

Verify that supplemental logging has been turned on for these tables.
GGSCI> INFO TRANDATA ggtest.TCUST*
Logging of supplemental redo log data is enabled for table GGTEST.TCUSTMER.

Columns supplementally logged for table GGTEST.TCUSTMER: CUST_CODE.

Logging of supplemental redo log data is enabled for table GGTEST.TCUSTORD.

Columns supplementally logged for table GGTEST.TCUSTORD: CUST_CODE, ORDER_DATE, PRODUCT_CODE, ORDER_ID.

 

Configure the Manager

Configure the Manager process on the target system

[oracle@ogg2 ogg]$ ggsci
GGSCI> EDIT PARAMS MGR

在文件中输入下面内容并保存:

port 7809


启动mgr:

GGSCI (ogg2) 4> start mgr

Manager started.

查看mgr信息:
 

GGSCI (ogg2) 7> info mgr

Manager is running (IP port ogg2.7809).

Create target Oracle tables

 

Shell> sqlplus ggusr/ggusr

SQL> @demo_ora_create
Verify the results:
SQL> desc tcustmer;
SQL> desc tcustord;
SQL> exit

Initial Data Load using Direct Load Method

Initial data capture

1. Add the initial load capture batch task group

Execute the following commands on the <source> system

GGSCI (ogg1) 6> add extract einiss, sourceistable
EXTRACT added.


GGSCI (ogg1) 7> info extract *, tasks

EXTRACT EINISS Initialized 2012-09-13 14:06 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record Record 0
Task SOURCEISTABLE

2. Configure the initial load capture parameter file

GGSCI> EDIT PARAMS EINISS

输入如下 内容:

EXTRACT EINISS
USERID ggusr, PASSWORD "ggusr"
RMTHOST 192.168.1.87, MGRPORT 7809
RMTTASK REPLICAT, GROUP RINITT
TABLE ggtest.tcustmer;
TABLE ggtest.tcustord;

Initial data delivery

3. Add the initial load delivery batch task

Execute the following commands on the <target> system.

GGSCI (ogg2) 9> add replicat rinitt,specialrun

4. Configure the initial load delivery parameter file

GGSCI (ogg2) 9> add replicat rinitt,specialrun

GGSCI (ogg2) 12> view params rinitt

REPLICAT RINITT
ASSUMETARGETDEFS
USERID ggusr, PASSWORD ggusr
DISCARDFILE ./dirrpt/RINITT.dsc, PURGE
MAP ggtest.*, TARGET ggtest.*;

5. Execute the initial load process

Execute the following commands on the <source> system.
GGSCI> START EXTRACT EINISS

Verify the results on the <source> system:
GGSCI> VIEW REPORT EINISS
Verify the results on the <target> system:
GGSCI> VIEW REPORT RINITT

在target端查看ggtest.tcustmer和ggtest.tcustord有无数据:

SQL> conn ggtest/ggtest
Connected.
SQL> select * from tcustmer;

CUST NAME CITY ST
---- ------------------------------ -------------------- --
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO

SQL> select * from tcustord;

CUST ORDER_DAT PRODUCT_ ORDER_ID PRODUCT_PRICE PRODUCT_AMOUNT TRANSACTION_ID
---- --------- -------- ---------- ------------- -------------- --------------
WILL 30-SEP-94 CAR 144 17520 3 100
JANE 11-NOV-95 PLANE 256 133300 1 100

到这里初始化已经成功了。

相关推荐