oracle ogg11.2下载,Oracle GoldenGate 11.2 OGG

数据同步出问题的表没有主键,客户执行insert的时候没有问题,在执行update的时候报了上面的错误。以上的报错涉及三个参数,KEYCOLS,ALLOWNOOPUPDATES,APPLYNOOPUPDATES。下面我们分别讨论这3个参数:

1)KEYCOLS

KEYCOLS关键字用于对没有主键的表,指定能够唯一标识数据的字段,这样Oracle GoldenGate同样可以完成数据的同步(同步UPDATE操作)。

将目标数据库的replicat配置修改为:

MAP CCENSE.ST_CARDOPERATORSTATTMP, TARGET CCENSE.ST_CARDOPERATORSTATTMP, KEYCOLS(cardsfid)

重启目标数据库的replicat进程即可完成数据的同步,但需要注意的是,使用这种方式必须把所有的表列出来,不能指定为.*。

2)ALLOWNOOPUPDATES

官方文档解释如下:

ALLOWNOOPUPDATES | NOALLOWNOOPUPDATES

Valid forReplicat

Use ALLOWNOOPUPDATES and NOALLOWNOOPUPDATES to control how Replicat responds to a “noop”

operation. A no-op operation is one in which there is no effect on the target table. The

following are some examples of how this can occur.

● The source table has a column that does not exist in the target table, or has a column

that was excluded from replication (with a COLSEXCEPT clause). In either case, if that

source column is updated, there will be no target column name to use in the SET clause

within the Replicat SQL statement.

● An update is made that sets a column to the same value as the current one. The

database does not log the new value, because it did not really change. However, Oracle

GoldenGate extracts the operation as a change record because the primary key was

logged — but there is no column value for the SET clause in the Replicat SQL statement.

By default (NOALLOWNOOPUPDATES), Replicat abends with an error because these types of

operations do not update the database. With ALLOWNOOPUPDATES, Replicat ignores the

operation instead of abending. The statistics reported by Replicat will show that an update

was made, but the database will not be updated.

You can use the internal parameter APPLYNOOPUPDATES to force the update to be applied.

APPLYNOOPUPDATES overrides ALLOWNOOPUPDATES. If both are specified then updates with

only key columns will be applied. By default, Oracle GoldenGate will abend with the

following message if it only has source key columns but there is no key defined for the target table.

2011-01-25 02:28:42 GGS ERROR 160 Encountered an update for target

table TELLER, which has no unique key defined. KEYCOLS can be used to

define a key. Use ALLOWNOOPUPDATES to process the update without applying

it to the target database. Use APPLYNOOPUPDATES to force the update to

be applied using all columns in both the SET and WHERE clause.

Exceptions when error-handling is in place

If ALLOWNOOPUPDATES is specified when the HANDLECOLLISIONS or INSERTMISSINGUPDATES

parameters are being used, and if Oracle GoldenGate has all of the target key values, then

Oracle GoldenGate will not ignore the update, but instead will apply it using all key

columns in the SET clause and the WHERE clause (invoking APPLYNOOPUPDATES behavior). This

is necessary so Oracle GoldenGate can detect if the row being updated is missing. If it is,

then Oracle GoldenGate turns the update into an insert.

Default NOALLOWNOOPUPDATES (only applies if the table does not have a key)Syntax ALLOWNOOPUPDATES | NOALLOWNOOPUPDATES

该参数的含义就是在同步到目标数据库的时候忽略出现的NO-OP操作,NO-OP操作包括目标数据库没有主数据库的字段(两边数据库字段不同),还有一种情况是执行UPDATE语句修改的数据和原有数据一样,没有发生变化。以上两种情况叫做NO-OP操作,遭遇NO-OP操作gg会被终止。

3)APPLYNOOPUPDATES

该参数的含义就是不忽略出现的NO-OP操作,而是在目标数据库强制执行UPDATE修改操作,且只更新键值数据(主键或KEYCOLS指定的键值),如果表没有主键,也没有使用KEYCOLS关键字指定字段,那么将更新表数据的所有字段,如果没有相应记录,将INSERT新插入一条。

官方文档解释如下:

APPLYNOOPUPDATES | NOAPPLYNOOPUPDATES

Valid for Replicat

Use APPLYNOOPUPDATES to force a “no-op” update to be applied using all columns in both the

SET and WHERE clauses. See ALLOWNOOPUPDATES | NOALLOWNOOPUPDATES for a description of

“no-op.”

APPLYNOOPUPDATES uses whatever data is in the trail. If there is a primary key update

record, it uses the before columns from the source. If there is a regular (non-key) update,

it assumes that the after value is the same as the before value (otherwise it would be a

primary key update). The preceding assumes source and target keys are identical. If they

are not, you must use a KEYCOLS clause in the TABLE statement on the source.

Default NOAPPLYNOOPUPDATES

Syntax APPLYNOPUPDATES | NOAPPLYNOPUPDATES

请注意,我们在讨论NO-OP操作的时候,NO-OP操作并不包含UPDATE没有主键的表,所以我们遇到的这个问题和ALLOWNOOPUPDATES和APPLYNOOPUPDATES这两个参数没有关系。通过实践证明,在replicat配置文件中加入这两个参数(或只加入ALLOWNOOPUPDATE参数),在更新没有主键,也没有指定KEYCOLS字段的表的时候同样会报错。对没有主键,但加上了KEYCOLS字段后的表执行UPDATE操作成功同步了数据。

如果没有在源数据库启用记录表的supplement log,同样会收到以上的报错,原因是在于没有记录没有主键表的supplement log数据,并将其传递到目标数据库,执行以下操作可以启用记录表的supplement log:

cd $GGHOME./ggscidblogin userid ,password add trandata .完成以上操作之后,可以解决由此问题导致的update不能同步。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值