In Database archiving is still possible on Partitioned Tables.
Think of In-Database archiving as something like this.
Rather than deleting the data, some application has the concept of “mark for delete”, so that data remains in table, but not used by application – this can be achieved by doing
a) Add an extra column to table – that holds a flag to indicate the data is deleted.
b) Add an extra column to SQL – that checks to exclude the deleted(inactive) rows from processing ( where deleted <> ‘N’)
In database archiving is a feature added up in 12c to allow this type of “mark for delete” functionality with few changes to application code
Rows that have been marked as archived are not visible (equivalent to a logical delete) unless the session is enabled to see archived data.
so think of In-Database archival as something equivalent to a logical deletes. no clean up of old data in tables (no physical delete), no more white space in tables, no more index rebuilds for table data cleanup.
demo@ORA12C> create table t
2 partition by hash(object_id)
3 ( partition p1, partition p2 )
4 as
5 select owner,object_id,object_name,object_type
6 from all_objects
7 where rownum <=10;
Table created.
demo@ORA12C> alter table t row archival;
Table altered.
demo@ORA12C> column ora_archive_state format a10
demo@ORA12C> select t.*,ora_archive_state from t;
OWNER OBJECT_ID OBJECT_NAME OBJECT_TYPE ORA_ARCHIV
---------- ---------- ------------------------------ ----------------------- ----------
SYS 133 ORA$BASE EDITION 0
PUBLIC 143 DUAL SYNONYM 0
SYS 417 MAP_OBJECT TABLE 0
SYS 523 TABLE_PRIVILEGE_MAP TABLE 0
SYS 524 I_TABLE_PRIVILEGE_MAP INDEX 0
SYS 142 DUAL TABLE 0
PUBLIC 418 MAP_OBJECT SYNONYM 0
SYS 520 SYSTEM_PRIVILEGE_MAP TABLE 0
SYS 521 I_SYSTEM_PRIVILEGE_MAP INDEX 0
PUBLIC 522 SYSTEM_PRIVILEGE_MAP SYNONYM 0
10 rows selected.
demo@ORA12C> update t
2 set ora_archive_state = dbms_ilm.archiveStateName(1)
3 where object_id <=200;
3 rows updated.
demo@ORA12C> select t.*,ora_archive_state from t;
OWNER OBJECT_ID OBJECT_NAME OBJECT_TYPE ORA_ARCHIV
---------- ---------- ------------------------------ ----------------------- ----------
SYS 417 MAP_OBJECT TABLE 0
SYS 523 TABLE_PRIVILEGE_MAP TABLE 0
SYS 524 I_TABLE_PRIVILEGE_MAP INDEX 0
PUBLIC 418 MAP_OBJECT SYNONYM 0
SYS 520 SYSTEM_PRIVILEGE_MAP TABLE 0
SYS 521 I_SYSTEM_PRIVILEGE_MAP INDEX 0
PUBLIC 522 SYSTEM_PRIVILEGE_MAP SYNONYM 0
7 rows selected.
demo@ORA12C> alter session set row archival visibility=all;
Session altered.
demo@ORA12C> select t.*,ora_archive_state from t;
OWNER OBJECT_ID OBJECT_NAME OBJECT_TYPE ORA_ARCHIV
---------- ---------- ------------------------------ ----------------------- ----------
SYS 133 ORA$BASE EDITION 1
PUBLIC 143 DUAL SYNONYM 1
SYS 417 MAP_OBJECT TABLE 0
SYS 523 TABLE_PRIVILEGE_MAP TABLE 0
SYS 524 I_TABLE_PRIVILEGE_MAP INDEX 0
SYS 142 DUAL TABLE 1
PUBLIC 418 MAP_OBJECT SYNONYM 0
SYS 520 SYSTEM_PRIVILEGE_MAP TABLE 0
SYS 521 I_SYSTEM_PRIVILEGE_MAP INDEX 0
PUBLIC 522 SYSTEM_PRIVILEGE_MAP SYNONYM 0
10 rows selected.
demo@ORA12C> alter session set row archival visibility=active;
Session altered.
demo@ORA12C> select t.*,ora_archive_state from t;
OWNER OBJECT_ID OBJECT_NAME OBJECT_TYPE ORA_ARCHIV
---------- ---------- ------------------------------ ----------------------- ----------
SYS 417 MAP_OBJECT TABLE 0
SYS 523 TABLE_PRIVILEGE_MAP TABLE 0
SYS 524 I_TABLE_PRIVILEGE_MAP INDEX 0
PUBLIC 418 MAP_OBJECT SYNONYM 0
SYS 520 SYSTEM_PRIVILEGE_MAP TABLE 0
SYS 521 I_SYSTEM_PRIVILEGE_MAP INDEX 0
PUBLIC 522 SYSTEM_PRIVILEGE_MAP SYNONYM 0
7 rows selected.
demo@ORA12C>