Oracle GoldenGate学习之--AIX 系统安装配置
系统环境
操作系统:AIX5.3-09
DB Soft: Oracle 10gR2
如下图所示:
系统环境实在AIX系统上构建单向OGG
下载OGG:
一、安装OGG1、解压安装ogg
在AIX211主机配置安装ogg:
[root@aix21ogg]#lsogg112101_ggs_AIX_ppc_ora10.2_64bit.zip
[root@aix211 ogg]#unzip ogg112101_ggs_AIX_ppc_ora10.2_64bit.zipArchive: ogg112101_ggs_AIX_ppc_ora10.2_64bit.zip
inflating: ggs_AIX_ppc_ora10.2_64bit.tar
inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.1.pdf
inflating: Oracle GoldenGate 11.2.1.0.1 README.doc
inflating: Oracle GoldenGate 11.2.1.0.1 README.txt
[root@aix211 ogg]#lsOGG_WinUnix_Rel_Notes_11.2.1.0.1.pdf ggs_AIX_ppc_ora10.2_64bit.tar
Oracle GoldenGate 11.2.1.0.1 README.doc lost+found
Oracle GoldenGate 11.2.1.0.1 README.txt ogg112101_ggs_AIX_ppc_ora10.2_64bit.zip
[root@aix211 ogg]#tar xvf ggs_AIX_ppc_ora10.2_64bit.tarx .
x ./mgr, 4421047 bytes, 8635 tape blocks
x ./ggsci, 5779790 bytes, 11289 tape blocks
x ./ggcmd, 2871133 bytes, 5608 tape blocks
x ./ggMessage.dat, 1257280 bytes, 2456 tape blocks
x ./help.txt, 169753 bytes, 332 tape blocks
x ./tcperrs, 759 bytes, 2 tape blocks
x ./bcrypt.txt, 1725 bytes, 4 tape blocks
x ./libxml2.txt, 1668 bytes, 4 tape blocks
x ./zlib.txt, 1476 bytes, 3 tape blocks
x ./freeBSD.txt, 1968 bytes, 4 tape blocks
x ./notices.txt, 213535 bytes, 418 tape blocks
x ./libxerces-c.a, 9209080 bytes, 17987 tape blocks
x ./libicui18n38.a, 9302329 bytes, 18169 tape blocks
x ./libicuuc38.a, 6302602 bytes, 12310 tape blocks
x ./libicudata38.a, 15580952 bytes, 30432 tape blocks
x ./libantlr3c.so, 260012 bytes, 508 tape blocks
......
2、创建ogg缺省目录
[root@aix211 ogg]#./ggsci
Could not load program ./ggsci:
Dependent module libclntsh.so could not be loaded.
Could not load module libclntsh.so.
System error: No such file or directory
出现以上错误!
[root@aix211 /]#chown -R oracle:dba /ogg
[root@aix211 ogg]#su - oracle
[oracle@aix211 ~]$cd /ogg
[oracle@aix211 ogg]$./ggsciOracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
AIX 5L, ppc, 64bit (optimized), Oracle 10.2 on Apr 23 2012 07:27:46
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (aix211) 2> help
GGSCI Command Summary:
Object: Command:
SUBDIRS CREATE
ER INFO, KILL, LAG, SEND, STATUS, START, STATS, STOP
EXTRACT ADD, ALTER, CLEANUP, DELETE, INFO, KILL,
LAG, REGISTER, SEND, START, STATS, STATUS, STOP
UNREGISTER
EXTTRAIL ADD, ALTER, DELETE, INFO
GGSEVT VIEW
MANAGER INFO, SEND, START, STOP, STATUS
MARKER INFO
PARAMS EDIT, VIEW
REPLICAT ADD, ALTER, CLEANUP, DELETE, INFO, KILL, LAG, SEND,
START, STATS, STATUS, STOP
REPORT VIEW
RMTTRAIL ADD, ALTER, DELETE, INFO
TRACETABLE ADD, DELETE, INFO
TRANDATA ADD, DELETE, INFO
SCHEMATRANDATA ADD, DELETE, INFO
CHECKPOINTTABLE ADD, DELETE, CLEANUP, INFO
Commands without an object:
(Database) DBLOGIN, LIST TABLES, ENCRYPT PASSWORD, FLUSH SEQUENCE
MININGDBLOGIN
(DDL) DUMPDDL
(Miscellaneous) FC, HELP, HISTORY, INFO ALL, OBEY, SET EDITOR, SHELL,
SHOW, VERSIONS, ! (note: you must type the word
COMMAND after the ! to display the ! help topic.)
i.e.: GGSCI (sys1)> help ! command
For help on a specific command, type HELP .
Example: HELP ADD REPLICAT
GGSCI (aix211) 3> 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
在AIX212安装配置ogg:[root@aix212@ /]#chown oracle:dba /ogg
[root@aix212@ /]#su - oracle
[u@h@ W]$cd /ogg
[u@h@ W]$bash
[oracle@aix212@ ogg]$./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
AIX 5L, ppc, 64bit (optimized), Oracle 10.2 on Apr 23 2012 07:27:46
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (aix212) 1> help
GGSCI Command Summary:
Object: Command:
SUBDIRS CREATE
ER INFO, KILL, LAG, SEND, STATUS, START, STATS, STOP
EXTRACT ADD, ALTER, CLEANUP, DELETE, INFO, KILL,
LAG, REGISTER, SEND, START, STATS, STATUS, STOP
UNREGISTER
EXTTRAIL ADD, ALTER, DELETE, INFO
GGSEVT VIEW
MANAGER INFO, SEND, START, STOP, STATUS
MARKER INFO
PARAMS EDIT, VIEW
REPLICAT ADD, ALTER, CLEANUP, DELETE, INFO, KILL, LAG, SEND,
START, STATS, STATUS, STOP
REPORT VIEW
RMTTRAIL ADD, ALTER, DELETE, INFO
TRACETABLE ADD, DELETE, INFO
TRANDATA ADD, DELETE, INFO
SCHEMATRANDATA ADD, DELETE, INFO
CHECKPOINTTABLE ADD, DELETE, CLEANUP, INFO
Commands without an object:
(Database) DBLOGIN, LIST TABLES, ENCRYPT PASSWORD, FLUSH SEQUENCE
MININGDBLOGIN
(DDL) DUMPDDL
(Miscellaneous) FC, HELP, HISTORY, INFO ALL, OBEY, SET EDITOR, SHELL,
SHOW, VERSIONS, ! (note: you must type the word
COMMAND after the ! to display the ! help topic.)
i.e.: GGSCI (sys1)> help ! command
For help on a specific command, type HELP .
Example: HELP ADD REPLICAT
GGSCI (aix212) 2>
二、数据库配置
源端(AIX212)1、建立数据的归档模式
SQL> alter database archivelog;
Database altered.
SQL> alter database force logging;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/arch_orcl
Oldest online log sequence 2
Next log sequence to archive 4
Current log sequence 4
2、创建ogg用户并授权
[oracle@aix212@ ~]$sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 23 14:46:43 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create tablespace oggtbs
2 datafile
3 '/u01/app/oracle/oradata/orcl/oggtbs1.dbf' size 100m;
Tablespace created.
SQL> create user ogg identified by ogg default tablespace oggtbs;
User created.
SQL> grant connect,resource to ogg;
Grant succeeded.
SQL> grant create session,alter session to ogg;
Grant succeeded.
SQL> grant select any dictionary,select any table to ogg;
Grant succeeded.
SQL> grant alter any table to ogg;
Grant succeeded.
SQL> grant flashback any table to ogg;
Grant succeeded.
SQL> grant execute on dbms_flashback to ogg;
Grant succeeded.
3、创建传输的对象(table)
SQL> conn scott/tiger
Connected.
SQL> create table emp_ogg as select * from emp;
Table created.
SQL> alter table emp_ogg add constraint pk_ogg primary key (empno);
Table altered.
目标端(AIX211)
1、创建ogg用户并授权
SQL> create tablespace oggtbs
2 datafile
3 '/u01/app/oracle/oradata/prod/oggtbs1.dbf' size 100m;
Tablespace created.
SQL> create user ogg identified by ogg default tablespace oggtbs;
User created.
SQL> grant dba to ogg;
Grant succeeded.
创建测试对象
SQL> conn scott/tiger
Connected.
SQL> create table emp_ogg as select * from emp where 1=2;
Table created.
三、配置OGG
源端配置(AIX212)
1、配置mgr[oracle@ogg aix212]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
AIX 5L, ppc, 64bit (optimized), Oracle 10.2 on Apr 23 2012 07:27:46
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
添加用于capture data change的table
GGSCI (aix212) 4> add trandata scott.emp_ogg
Logging of supplemental redo data enabled for table SCOTT.EMP_OGG.
GGSCI (aix212) 8> delete trandata scott.emp_ogg
Logging of supplemental redo log data disabled for table SCOTT.EMP_OGG.
GGSCI (aix212) 9> add trandata scott.emp_ogg
Logging of supplemental redo data enabled for table SCOTT.EMP_OGG.
查看在table上是否启用了supplemental log
GGSCI (aix212) 11> info trandata scott.emp_ogg
Logging of supplemental redo log data is enabled for table SCOTT.EMP_OGG.
Columns supplementally logged for table SCOTT.EMP_OGG: EMPNO.
GGSCI (aix212) 13> edit params mgr
port 7809
dynamicportlist 7800-8000
autorestart extract *,waitminutes 2,resetminutes 5
编辑mgr参数文件,并写入以上信息!
GGSCI (ogg) 14> start mgr
Manager started.
GGSCI (ogg) 16> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
配置pump进程
GGSCI (aix212) 21> add extract eora_1,tranlog,begin now
EXTRACT added.
GGSCI (aix212) 22> add exttrail ./dirdat/aa,extract eora_1,megabytes 5
EXTTRAIL added.
GGSCI (aix212) 23> edit params eora_1
EXTRACT EORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg,PASSWORD ogg
EXTTRAIL ./dirdat/aa
TABLE scott.emp_ogg;
GGSCI (aix212) 24> start extract eora_1
Sending START request to MANAGER ...
EXTRACT EORA_1 starting
GGSCI (aix212) 25> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EORA_1 00:04:51 00:00:00
GGSCI (aix212) 26> edit params pora_1
EXTRACT PORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
PASSTHRU
RMTHOST 192.168.8.211,MGRPORT 7809
RMTTRAIL ./dirdat/pa
TABLE scott.emp_ogg;
GGSCI (aix212) 27> add extract pora_1,exttrailsource ./dirdat/pa
EXTRACT added.
GGSCI (aix212) 28> add rmttrail ./dirdat/pa,extract pora_1,megabytes 5
RMTTRAIL added.
GGSCI (aix212) 29> start extract pora_1
Sending START request to MANAGER ...
EXTRACT PORA_1 starting
GGSCI (aix212) 31> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EORA_1 00:00:00 00:00:06
EXTRACT RUNNING PORA_1 00:00:00 00:00:00
目标端(AIX211)
查看ogg日志:
源端(aix212)[oracle@aix212@ ~]$tail -f /ogg/ggserr.log
2014-09-23 15:25:24 INFO OGG-03035 Oracle GoldenGate Capture for Oracle, pora_1.prm: Operating system character set identified as ISO-8859-1. Locale: en_US_POSIX, LC_ALL:.
2014-09-23 15:25:24 INFO OGG-01815 Oracle GoldenGate Capture for Oracle, pora_1.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/ogg/dirtmp.
2014-09-23 15:25:24 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, pora_1.prm: EXTRACT PORA_1 started.
2014-09-23 15:25:30 INFO OGG-01226 Oracle GoldenGate Capture for Oracle, pora_1.prm: Socket buffer size set to 27985 (flush size 27985).
2014-09-23 15:25:30 INFO OGG-01052 Oracle GoldenGate Capture for Oracle, pora_1.prm: No recovery is required for target file ./dirdat/pa000000, at RBA 0 (file not opened).
2014-09-23 15:25:30 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, pora_1.prm: Output file ./dirdat/pa is using format RELEASE 11.2.
2014-09-23 15:47:44 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start eini-1.
2014-09-23 15:47:51 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start eini_1.
2014-09-23 15:47:51 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mgr.prm: Command received from GGSCI on host aix212 (START EXTRACT EINI_1 ).
2014-09-23 15:47:51 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: EXTRACT EINI_1 starting.
2014-09-23 15:47:51 INFO OGG-01017 Oracle GoldenGate Capture for Oracle, eini_1.prm: Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used.
2014-09-23 15:47:51 INFO OGG-00992 Oracle GoldenGate Capture for Oracle, eini_1.prm: EXTRACT EINI_1 starting.
2014-09-23 15:47:51 INFO OGG-03035 Oracle GoldenGate Capture for Oracle, eini_1.prm: Operating system character set identified as ISO-8859-1. Locale: en_US_POSIX, LC_ALL:.
2014-09-23 15:47:51 INFO OGG-01815 Oracle GoldenGate Capture for Oracle, eini_1.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/ogg/dirtmp.
2014-09-23 15:47:51 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, eini_1.prm: EXTRACT EINI_1 started.
目标端(aix211)[oracle@aix211 ogg]$tail -f ggserr.log
2014-09-23 15:26:58 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mgr.prm: Command received from GGSCI on host aix211 (START REPLICAT RORA_1 ).
2014-09-23 15:26:58 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: REPLICAT RORA_1 starting.
2014-09-23 15:26:59 INFO OGG-00995 Oracle GoldenGate Delivery for Oracle, rora_1.prm: REPLICAT RORA_1 starting.
2014-09-23 15:26:59 INFO OGG-03035 Oracle GoldenGate Delivery for Oracle, rora_1.prm: Operating system character set identified as ISO-8859-1. Locale: en_US_POSIX, LC_ALL:.
2014-09-23 15:27:00 INFO OGG-01815 Oracle GoldenGate Delivery for Oracle, rora_1.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/ogg/dirtmp.
2014-09-23 15:27:01 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, rora_1.prm: REPLICAT RORA_1 started.
四、同步测试
@至此,目标端同源端的数据同步成功,OGG的单向传输基本配置完成!