开启用户级别的附加日志的管理用户必须具有执行DBMS_CAPTURE_ADM包的权限;可以在GoldenGate GGSCI命令行下登录到数据库管理用户为其它的用户开启附加日志;
在GGSCI命令行下使用DBLOGIN命令登录到数据库管理用户
为用户启用附加日志
GGSCI (sywu as ogg_owner@sydb) 2> add schematrandata sywu 2015-08-24 14:56:26 INFO OGG-01788 SCHEMATRANDATA has been added on schema sywu. 2015-08-24 14:56:27 INFO OGG-01976 SCHEMATRANDATA for scheduling columns has been added on schema sywu.取消用户附加日志
GGSCI (sywu as ogg_owner@sydb) 6> delete schematrandata sywu 2015-08-25 20:14:49 INFO OGG-01792 SCHEMATRANDATA has been deleted on schema sywu. 2015-08-25 20:14:49 INFO OGG-01979 SCHEMATRANDATA for scheduling columns has been deleted on schema sywu. 1.2.3 表级别的附加日志 在没有启用用户级别的附加日志的情况下表级别的主键或唯一索引附加日志对于GoldenGate是必须的;在某些情况下即使你启用了用户级别的附加日志,你也可以启用表级别的附加日志使主键附加日志替代每一个在用户级别为GoldenGate指定的键;必须在表没有主键或唯一索引的情况下启用表级别的附加日志。
在GGSCI命令行下使用dblogin登录到数据库管理用户
为表启用附加日志
GGSCI (sywu as ogg_owner@sydb) 3> add trandata ogg_owner.togg Logging of supplemental redo data enabled for table OGG_OWNER.TOGG. TRANDATA for scheduling columns has been added on table 'OGG_OWNER.TOGG'.注意:仅当该表有主键或唯一索引时使用上面的命令启用表级别的附加日志,如果表中没有主键或唯一索引时则必须指定一个或多个或者全部列做为主键,在GoldenGate这些键的作用是过滤重复的数据。
SYS@sydb>create table ogg_owner.togg_nokey(id,name,type,CREATED,update_date) 2 as 3 select object_id,object_name,object_type,CREATED,sysdate from dba_objects where rownum<1001 5 / Table created. Elapsed: 00:00:00.11错误的启用没有主键的表级别附加日志:
GGSCI (sywu as ogg_owner@sydb) 4> add trandata ogg_owner.togg_nokey 2015-08-24 16:05:01 WARNING OGG-06439 No unique key is defined for table TOGG_NOKEY. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key. Logging of supplemental redo data enabled for table OGG_OWNER.TOGG_NOKEY. TRANDATA for scheduling columns has been added on table 'OGG_OWNER.TOGG_NOKEY'.正确的启用没有主键的表级别附加日志:
GGSCI (sywu as ogg_owner@sydb) 26> add trandata ogg_owner.togg_nokey,cols (ID),nokey 2015-08-24 16:33:19 WARNING OGG-06439 No unique key is defined for table TOGG_NOKEY. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key. Logging of supplemental redo data enabled for table OGG_OWNER.TOGG_NOKEY. TRANDATA for scheduling columns has been added on table 'OGG_OWNER.TOGG_NOKEY'. 2 配置GoldenGate 2.1 GoldenGate MGR进程MGR进程管理启动Oracle GoldenGate进程、启动动态进程、分配端口给GoldenGate进程、管理trail file、创建事件,错误和诊断报告工作,必须在第一时间启动;当某些原因导致GoldenGate崩溃或重启机器时,默认情况MGR是没有启动的
[oracle@sywu ogg_src]$ tggsci Oracle GoldenGate Command Interpreter for Oracle Version 12.1.2.1.0 OGGCORE_12.1.2.1.0_PLATFORMS_140727.2135.1_FBO Linux, x64, 64bit (optimized), Oracle 11g on Aug 7 2014 09:14:25 Operating system character set identified as UTF-8. Copyright (C) 1995, 2014, Oracle and/or its affiliates. All rights reserved. GGSCI (sywu) 1> info mgr Manager is DOWN! 2.1.1 配置GoldenGate MGR进程可以通过直接编辑GoldenGate_home/dirprm/mgr.prm文件或进入GGSCI命令行后键入edit param mgr命令回车进入MGR配置文件vi编辑界面;
GGSCI (sywu as ogg_owner@sydb) 10> edit param mgr PORT 7809 DYNAMICPORTLIST 7810-7820 AUTOSTART ER E* AUTORESTART ER P*,RETRIES 4, WAITMINUTES 4 STARTUPVALIDATIONDELAY 5 参数说明PORT 表示MGR进程端口号
DYNAMICPORTLIST 表示MGR进���动态为其它进程如Extract进程、Replicat进程分配的端口
AUTOSTART、AUTORESTART 表示当MGR进程启动后失败时自动启动或重启的GoldenGate进程
2.1.2 启动mgr进程 GGSCI (sywu) 2> start mgr Manager started. GGSCI (sywu) 3> info mgr Manager is running (IP port sywu.7909, Process ID 17400).