1.环境:
数据库:11.2.0.3
源库:192.168.169.135
目标库:192.168.169.136https://www.cndba.cn/Expect-le/article/132
ogg:ogg112101_fbo_ggs_Linux_x64_ora11g_64bit
2.安装ogg软件
安装很简单,源库和目标库都要安装
上传
[root@lei ~]# cd /u01/
[root@lei u01]# mkdir ogg
[root@lei u01]# cd ogg/
[root@lei ogg]# rz -E
rz waiting to receive.
[root@lei ogg]# ll
total 87192
-rw-r--r-- 1 root root 89186858 Jun 8 09:23 ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
解压
[root@lei ogg]# unzip ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
Archive: ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar
inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.1.pdf
inflating: Oracle GoldenGate 11.2.1.0.1 README.txt
inflating: Oracle GoldenGate 11.2.1.0.1 README.doc
[root@lei ogg]# ll
total 310956
-rw-rw-r-- 1 root root 228556800 Apr 23 2012 fbo_ggs_Linux_x64_ora11g_64bit.tar
-rw-r--r-- 1 root root 89186858 Jun 8 09:23 ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
[root@lei ogg]# tar -xvof fbo_ggs_Linux_x64_ora11g_64bit.tar
赋权限https://www.cndba.cn/Expect-le/article/132
[root@lei ogg]# chown -R oracle:oinstall /u01/
用oracle用户进入ogg后台
[oracle@lei 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, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (lei) 1> create subdirs
Creating subdirectories under current directory /u01/ogg
Parameter files /u01/ogg/dirprm: already exists
Report files /u01/ogg/dirrpt: created
Checkpoint files /u01/ogg/dirchk: created
Process status files /u01/ogg/dirpcs: created
SQL script files /u01/ogg/dirsql: created
Database definitions files /u01/ogg/dirdef: created
Extract data files /u01/ogg/dirdat: created
Temporary files /u01/ogg/dirtmp: created
Stdout files /u01/ogg/dirout: created
GGSCI (lei) 2> exit
OK安装好了。。
3.开始配置ogg
3.1将源端数据同步到目标端
源库上创建专用表空间,用户
SQL> create tablespace ggs datafile '/u01/app/oracle/oradata/orcl/ggs01.dbf' size 50m,'/u01/app/oracle/oradata/orcl/ggs02.dbf' size 50m;
Tablespace created.
SQL> create user gate01 identified by gate01 default tablespace ggs temporary tablespace TEMP quota unlimited on ggs;
User created.
SQL> grant connect,resource,dba to gate01;
Grant succeeded.
在源数据库上建数据库用户 gate 01 的表 TC USTME R、 TC USTOR D,并插入记录
SQL> @/u01/ogg/demo_ora_create.sql
DROP TABLE tcustmer
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
DROP TABLE tcustord
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
SQL> @/u01/ogg/demo_ora_insert.sql
1 row created.
1 row created.
1 row created.
1 row created.
Commit complete.
SQL> commit;
Commit complete.
在目标库上同样创建表空间,用户
SQL> create tablespace ggs datafile '/u01/app/oracle/oradata/orcl/ggs01.dbf' size 50m,'/u01/app/oracle/oradata/orcl/ggs02.dbf' size 50m;
Tablespace created.
SQL> SQL>
SQL> create user gate02 identified by gate02 default tablespace ggs temporary tablespace TEMP quota unlimited on ggs;
User created.
SQL> grant connect,resource,dba to gate02;
Grant succeeded.
在目标数据库上建数据库用户 gate02 的表 TCUSTMER、 TCUSTORD,不需要插入
记录
SQL> conn gate02/gate02
Connected.
SQL> @/u01/ogg/demo_ora_create.sql
DROP TABLE tcustmer
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
DROP TABLE tcustord
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
3.2源库上配置管理进程MGR
GGSCI (lei) 13> start extract eora01
Sending START request to MANAGER ...
EXTRACT EORA01 starting
GGSCI (lei) 14> view report eora01------查看是否有报错
2015-10-26 16:03:44 INFO OGG-01017 Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used
.
***********************************************************************
Oracle GoldenGate Capture for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:42:16
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
Starting at 2015-10-26 16:03:44
***********************************************************************
Operating System Version:
Linux
Version #1 SMP Wed Feb 22 17:37:40 EST 2012, Release 2.6.32-300.10.1.el5uek
Node: lei
Machine: x86_64
soft limit hard limit
Address Space Size : unlimited unlimited
Heap Size : unlimited unlimited
File Size : unlimited unlimited
CPU Time : unlimited unlimited
Process id: 10304
Description:
***********************************************************************
** Running with the following parameters **
***********************************************************************
2015-10-26 16:03:44 INFO OGG-03035 Operating system character set identified as UTF-8. Locale: en_US,
LC_ALL:.
extract eora01
userid gate01, password ******
2015-10-26 16:03:44 INFO OGG-03500 WARNING: NLS_LANG environment variable does not match database cha
racter set, or not set. Using database character set value of WE8MSWIN1252.
rmthost 192.168.169.136, mgrport 7809
rmttask replicat, group rora01
table gate01.*;
Wildcard TABLE resolved (entry gate01.*):
table "GATE01"."TCUSTMER";
Using the following key columns for source table GATE01.TCUSTMER: CUST_CODE.
Wildcard TABLE resolved (entry gate01.*):
table "GATE01"."TCUSTORD";
Using the following key columns for source table GATE01.TCUSTORD: CUST_CODE, ORDER_DATE, PRODUCT_CODE, ORD
ER_ID.
2015-10-26 16:03:45 INFO OGG-01815 Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/u01/ogg/dirtmp.
CACHEMGR virtual memory values (may have been adjusted)
CACHESIZE: 64G
CACHEPAGEOUTSIZE (normal): 8M
PROCESS VM AVAIL FROM OS (min): 128G
CACHESIZEMAX (strict force to disk): 96G
Database Version:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE11.2.0.3.0Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Database Language and Character Set:
NLS_LANG