Blockchain Tables in Oracle Database 21c

Blockchain Tables in Oracle Database 21c
A blockchain table is a tamper-proof, insert-only table with an associated table-level and row-level retention period. Rows are organised into chains, with each row containing a hash of the data contained in the row, and the hash of the previous rows data.

This feature has been backported to Oracle 19.10, but also requires patch 32431413 and the COMPATIBLE parameter set to 19.10.0 or later. From 19.11 the additional patch is not required.

When learning about blockchain tables, be careful not to set excessively long retention periods, or you will have to wait a long time to drop your test tables.

Create a Blockchain Table

  • Alter a Blockchain Table
  • Blocked DML and DDL Operations
  • DBMS_BLOCKCHAIN_TABLE Package
  • Considerations
  • Related articles.

Blockchain Tables in Oracle Database 21c 
Create a Blockchain Table
In addition to adding the BLOCKCHAIN keyword to the CREATE TABLE command, there are three blockchain clauses.

The NO DROP clause determines how long the table is protected from being dropped. If the table has no rows it can still be dropped. Unlike the initial releases of blockchain tables, in (19.11 and 21.3) the NO DROP clause also prevents the table being dropped via a DROP USER ... CASCADE command.

NO DROP [ UNTIL number DAYS IDLE ]
NO DROP : The table can't be dropped. Be careful about using this setting during testing.
NO DROP UNTIL number DAYS IDLE : The table can't dropped until there have been no new rows inserted for the specified number of days. You may prefer to use 0 or 1 as the number of days during testing this functionality.
The NO DELETE clause determines the retention period. How long each row will be protected from deletion.

 

NO DELETE { [ LOCKED ] | (UNTIL number DAYS AFTER INSERT [ LOCKED ]) }
NO DELETE : Each row is retained forever. The absence of the LOCKED keyword implies the setting can be changed with the ALTER TABLE command, but it can't. Retention periods can only be increased.
NO DELETE LOCKED : Same as NO DELETE.
NO DELETE UNTIL number DAYS AFTER INSERT : Each row is protected from deletion for the specified number of days, but this setting can be increased using the ALTER TABLE command. Minimum 16 days.
NO DELETE UNTIL number DAYS AFTER INSERT LOCKED : Each row is protected from deletion for the specified number of days, and this setting can't be changed using the ALTER TABLE command. Minimum 16 days.
The blockchain hash and data format clause is fixed in the current release. It looks like it will allow alternative hashing algorithms in future releases.

HASHING USING sha2_512 VERSION v1
Putting it all together gives us something like the following.

Knowmore >>