发布于:2021-02-20 00:00:50
0
234
0
Oracle GoldenGate 18c现在支持Oracle数据库12c中引入的一些新功能,即支持身份列和数据库内行存档中的。
Identity columns允许我们指定一个列应该从系统创建的序列中自动填充,该序列类似于MySQL中的AUTO_INCREMENT列或sqlserver中的Identity列。 Oracle 12c信息生命周期管理(ILM)功能称为数据库归档,它使数据库能够区分活动数据和“较旧”的非活动数据,同时将所有数据存储在同一数据库中。 当我们为一个表启用行存档时,一个名为ORA_ARCHIVE_STATE column的隐藏列被添加到该表中,该列被自动赋值为0以表示当前数据,我们可以决定表中哪些数据被视为行存档的候选数据,并将其赋值为1 一旦区分了较旧和较新的数据,我们就可以存档和压缩较旧的数据以减小数据库的大小,或者将较旧的数据移动到较便宜的存储层以降低存储数据的成本。 请注意,Oracle GoldenGate支持这些功能需要Oracle Database 18c及以上版本。它还需要使用集成提取和集成复制或集成并行复制 身份列 请注意,表POSITION_ID中的IDENTITY COLUMN会自动填充。 SQL> insert into hr.job_positions 验证摘录是否捕获了更改 GGSCI (rac01.localdomain) 3> stats ext1 latest 验证是否已对目标表执行了复制 SQL> select * from hr.job_positions; 在数据库内行存档中 启用的行存档系统.MYOBJECTS桌子。此表基于数据字典对象ALL_OBJECTS SQL> alter table system.myobjects row archival; 我们现在执行行存档。早于2018年7月1日的数据被视为“旧”数据,需要存档。使用ORA_ARCHIVE_ STATE=DBMS_ILM.ARCHIVESTATENAME文件名(1) 子句来实现这一行的存档。 如果在执行存档之后查询表,我们会看到它现在显示表只有310行,而不是71710行! SQL> select count(*) from system.myobjects; 验证摘录是否捕获了此更新语句 GGSCI (host01.localdomain as c##oggadmin@ORCLCDB/PDB1) 19> stats ext1 latest 请注意,复制也在目标表上执行,并且在目标表上启用了行存档,我们只看到表中的310行。 GGSCI (host02.localdomain) 10> stats rep1 latest
2 (position_name)
3 values
4 ('President');
1 row created.
SQL> insert into hr.job_positions
2 (position_name)
3 values
4 ('Vice-President');
1 row created.
SQL> insert into hr.job_positions
2 (position_name)
3 values
4 ('Manager');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from hr.job_positions;
POSITION_ID POSITION_NAME
----------- --------------------
1 President
2 Vice-President
3 Manager
Sending STATS request to EXTRACT EXT1 ...
Start of Statistics at 2019-01-16 12:01:19.
Output to ./dirdat/ogg1/lt:
Extracting from PDB1.HR.JOB_POSITIONS to PDB1.HR.JOB_POSITIONS:
*** Latest statistics since 2019-01-16 12:00:15 ***
Total inserts 3.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 3.00
End of Statistics.
POSITION_ID POSITION_NAME
----------- --------------------
1 President
2 Vice-President
3 Manager
Table altered.
SQL> select distinct ora_archive_state from system.myobjects;
ORA_ARCHIVE_STATE
--------------------------------------------------------------------------------
0
COUNT(*)
----------
71710
SQL> select count(*) from system.myobjects where created < '01-JUL-18';
COUNT(*)
----------
71400
SQL> select count(*) from system.myobjects where created > '01-JUL-18';
COUNT(*)
----------
310
SQL> update system.myobjects
set ORA_ARCHIVE_STATE=DBMS_ILM.ARCHIVESTATENAME(1)
where created commit;
Commit complete.
SQL> select count(*) from system.myobjects;
COUNT(*)
----------
310
Sending STATS request to EXTRACT EXT1 ...
Start of Statistics at 2019-01-19 10:37:54.
Output to ./dirdat/lt:
Extracting from PDB1.SYSTEM.MYOBJECTS to PDB1.SYSTEM.MYOBJECTS:
*** Latest statistics since 2019-01-19 10:26:27 ***
Total inserts 71710.00
Total updates 71400.00
Total deletes 0.00
Total discards 0.00
Total operations 143110.00
End of Statistics.
Sending STATS request to REPLICAT REP1 ...
Start of Statistics at 2019-01-19 10:43:44.
Integrated Replicat Statistics:
Total transactions 2.00
Redirected 0.00
Replicated procedures 0.00
DDL operations 0.00
Stored procedures 0.00
Datatype functionality 0.00
Event actions 0.00
Direct transactions ratio 0.00%
Replicating from PDB1.SYSTEM.MYOBJECTS to PDB2.SYSTEM.MYOBJECTS:
*** Latest statistics since 2019-01-19 10:43:07 ***
Total inserts 71710.00
Total updates 71400.00
Total deletes 0.00
Total discards 0.00
Total operations 143110.00
End of Statistics.
SQL> select count(*) from system.myobjects;
COUNT(*)
----------
310
作者介绍