Oracle Goldengate 12.2現在可以複製不可見列,在以前的版本中是沒有此項功能的。
示例:
在源和目標都建立一個不可見和虛擬列commission
SQL> create table system.test_ogg
2 (empid number, salary number, commission number INVISIBLE generated always as (salary * .05) VIRTUAL );
Table created.
SQL> alter table system.test_ogg
2 add constraint pk_test_ogg primary key (empid);
Table altered.
如果我們不設定set colInvisible on,則預設是看不到commission列的。
SQL> desc system.test_ogg
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPID NUMBER
SALARY
SQL> SET COLINVISIBLE ON
SQL> desc system.test_ogg
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPID NUMBER
SALARY NUMBER
COMMISSION (INVISIBLE) NUMBER
源端插入一列,commission列的值基於salary欄位計算,另外,“SELECT *”不會列出不可見列
SQL> insert into system.test_ogg
2 values
3 (1001, 10000);
1 row created.
SQL> commit;
Commit complete.
SQL> select empid,salary,commission from system.test_ogg;
EMPID SALARY COMMISSION
---------- ---------- ----------
1001 10000 500
SQL> select * from system.test_ogg;
EMPID SALARY
---------- ----------
1001 10000
目標端的佇列檔案中已經有表結構資訊,即使源和目標端表結構不同,也不再需要使用sourceDefs和AssumeTargetDefs引數。
下面是日誌資訊,已經獲取到表結構資訊
2015-12-25 07:53:07 INFO OGG-02756 The definition for table SYSTEM.TEST_OGG is obtained from the trail file.
Skipping invisible column COMMISSION in default map.
2015-12-25 07:53:07 INFO OGG-06511 Using following columns in default map by name: EMPID, SALARY.
2015-12-25 07:53:07 INFO OGG-06510 Using the following key columns for target table SYSTEM.TEST_OGG: EMPID.
目標端可以複製不可見列對應的資料:
SQL> select empid,salary,commission from system.test_ogg;
EMPID SALARY COMMISSION
---------- ---------- ----------
1001 10000 500
示例:
在源和目標都建立一個不可見和虛擬列commission
SQL> create table system.test_ogg
2 (empid number, salary number, commission number INVISIBLE generated always as (salary * .05) VIRTUAL );
Table created.
SQL> alter table system.test_ogg
2 add constraint pk_test_ogg primary key (empid);
Table altered.
如果我們不設定set colInvisible on,則預設是看不到commission列的。
SQL> desc system.test_ogg
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPID NUMBER
SALARY
SQL> SET COLINVISIBLE ON
SQL> desc system.test_ogg
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPID NUMBER
SALARY NUMBER
COMMISSION (INVISIBLE) NUMBER
源端插入一列,commission列的值基於salary欄位計算,另外,“SELECT *”不會列出不可見列
SQL> insert into system.test_ogg
2 values
3 (1001, 10000);
1 row created.
SQL> commit;
Commit complete.
SQL> select empid,salary,commission from system.test_ogg;
EMPID SALARY COMMISSION
---------- ---------- ----------
1001 10000 500
SQL> select * from system.test_ogg;
EMPID SALARY
---------- ----------
1001 10000
目標端的佇列檔案中已經有表結構資訊,即使源和目標端表結構不同,也不再需要使用sourceDefs和AssumeTargetDefs引數。
下面是日誌資訊,已經獲取到表結構資訊
2015-12-25 07:53:07 INFO OGG-02756 The definition for table SYSTEM.TEST_OGG is obtained from the trail file.
Skipping invisible column COMMISSION in default map.
2015-12-25 07:53:07 INFO OGG-06511 Using following columns in default map by name: EMPID, SALARY.
2015-12-25 07:53:07 INFO OGG-06510 Using the following key columns for target table SYSTEM.TEST_OGG: EMPID.
目標端可以複製不可見列對應的資料:
SQL> select empid,salary,commission from system.test_ogg;
EMPID SALARY COMMISSION
---------- ---------- ----------
1001 10000 500