OGG能否复制迁移包含CLOB字段的table
作者:互联网
Oracle的官方文档“Can GoldenGate Replicate An Oracle Table That Contains Only CLOB Column(s)? (文档 ID 971833.1)
给出了解释:OGG并不支持CLOB的复制迁移。详见如下:
APPLIES TO:
Oracle GoldenGate - Version 4.0.0 and laterInformation in this document applies to any platform.
Question
Can GoldenGate replicate an Oracle table that contains only CLOB columns?
Answer
To ensure Data Integrity when performing Update and Delete operations, GoldenGate requires each Source and Target Table to have a Unique Identifier. This Unique Identifier can be: * a Primary Key * a Unique Index * one or more columns that contain unique values and are specified with a GoldenGate KEYCOLS clause.
To make those columns available to GoldenGate, they must be logged to the Redo Log byOracle's Supplemental Logging feature. Oracle does not support Supplemental Logging for CLOB columns; therefore Updates and Deletes on those columns cannot be replicated by GoldenGate.
据上,简单翻译之:
Oracle为确保执行更新和删除操作时的数据完整性,GoldenGate要求源和目标表具有唯一的标识符。这个唯一标识符可以是:主键、唯一索引、包含唯一值的一个或多个列,并使用GoldenGate KEYCOLS子句指定。要使这些列对GoldenGate可用,必须通过Oracle的补充日志功能将它们记录到Redo日志中。Oracle不支持为CLOB列添加日志记录;故,GoldenGate也就无法复制这些列上的更新和删除。
那么,使用OGG在做迁移时,如何进行操作呐?
答案:这里给出一种方案,结合oracle export方式;
步骤如下:
1. 使用OGG同步没有clob和blob类型数据的表
使用oracle系统视图all_tab_columns和PL/SQL在导出表的时候提供的Object selection功能快速导出不包含clob和blob的表数据,命令如下:
SELECT DISTINCT ('TABLE "'
|| a.OWNER
|| '"."'
|| a.TABLE_NAME
|| '"')
FROM sys.all_tab_columns a
WHERE a.OWNER = 'CA_GROUP'
AND a.TABLE_NAME NOT IN
(SELECT t.TABLE_NAME
FROM sys.all_tab_columns t
WHERE t.OWNER = 'CA_GROUP'
AND t.DATA_TYPE IN ('CLOB', 'BLOB')
);
以上命令,会找出不包含CLOB或BLOB的表,使用OGG先行同步数据;
2. 变更日,进行停库,使用expdp命令进行补数,将包含CLOB或BLOB的表进行单独迁移,为了加快导出速度,可加parallel并行度
SELECT DISTINCT ('TABLE "'
|| a.OWNER
|| '"."'
|| a.TABLE_NAME
|| '"')
FROM sys.all_tab_columns a
WHERE a.OWNER = 'CA_GROUP'
AND a.TABLE_NAME IN
(SELECT t.TABLE_NAME
FROM sys.all_tab_columns t
WHERE t.OWNER = 'CA_GROUP'
AND t.DATA_TYPE IN ('CLOB', 'BLOB')
);
标签:CLOB,OWNER,TABLE,Oracle,table,OGG,GoldenGate,columns 来源: https://www.cnblogs.com/jimoyu/p/12209883.html