Quantcast
Channel: Oracle DBA – Tips and Techniques
Viewing all articles
Browse latest Browse all 232

Oracle GoldenGate 18c New Features

$
0
0

Oracle GoldenGate 18c now provides support for some new features which were introduced in Oracle database 12c – namely support for Identity Columns and In-Database Row Archival.

Identity columns enables us to specify that a column should be automatically populated from a system-created sequence which is similar to the AUTO_INCREMENT column in MySQL or IDENTITY column in SQL Server.

The Oracle 12c Information Life Cycle Management (ILM) feature called In-Database Archiving provides the database the ability to distinguish from active data and ‘older’ inactive data while at the same time storing all the data in the same database.

When we enable row archival for a table, a hidden column called ORA_ARCHIVE_STATE column is added to the table and this column is automatically assigned a value of 0 to denote current data and we can decide what data in the table is to be considered as candidates for row archiving and they are assigned the value 1

Once the older and more current data is distinguished, we can archive and compress the older data to reduce the size of the database or move that older data to a cheaper storage tier to reduce cost of storing data.

Note that Oracle GoldenGate support for these features requires Oracle Database 18c and above. It also requires usage of the Integrated Extract and Integrated Replicat or Integrated Parallel Replicat.

 
Identity Columns

Note that the IDENTITY COLUMN in the table POSITION_ID is automatically populated.
 

SQL> insert into hr.job_positions
  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

 

Verify the extract has captured the changes
 

GGSCI (rac01.localdomain) 3> stats ext1 latest 

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.

 
Verify replication has been performed on the target table
 


SQL>  select * from hr.job_positions;

POSITION_ID POSITION_NAME
----------- --------------------
	  1 President
	  2 Vice-President
	  3 Manager

 
 
In-Database Row Archival
 

Enable row archival for the SYSTEM.MYOBJECTS table. This table is based on the data dictionary object ALL_OBJECTS


SQL> alter table system.myobjects row archival;

Table altered.

SQL> select distinct ora_archive_state from system.myobjects;

ORA_ARCHIVE_STATE
--------------------------------------------------------------------------------
0

 

We now perform the row archival. Data older than 01-JUL-18 is considered as ‘old’ and needs to be archived. Use the ORA_ARCHIVE_STATE=DBMS_ILM.ARCHIVESTATENAME(1) clause in the UPDATE statement to achieve this row archival.

If we query the table after the archival is performed, we see that it showing now that the table has only 310 rows and not 71710 rows!
 

SQL>  select count(*) from system.myobjects;

  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 <'01-JUL-18';  2    3  

71400 rows updated.

SQL> commit;

Commit complete.

SQL> select count(*) from system.myobjects;

  COUNT(*)
----------
       310

 
Verify the extract has captured this UPDATE statement
 

GGSCI (host01.localdomain as c##oggadmin@ORCLCDB/PDB1) 19> stats ext1 latest 

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.

 

Note that replication has also been performed on the target table and with row archival also enabled on the target table we see just 310 rows as present in the table.
 

GGSCI (host02.localdomain) 10> stats rep1 latest 

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

Viewing all articles
Browse latest Browse all 232

Trending Articles