Search notes:

Oracle: In-Database Archiving

Creating a table with the row archival clause …
create table tq84_a (
   id  integer primary key,
   txt varchar2(20)
)
row archival;
… adds an invisible column named ORA_ARCHIVE_STATE:
select
   column_name,
   data_type,
   hidden_column,
   user_generated
from
   user_tab_cols
where
   table_name = 'TQ84_A';
--
-- COLUMN_NAME        DATA_TYPE  HID  USE
-- -----------------  ---------  ---  ---
-- ORA_ARCHIVE_STATE  VARCHAR2   YES  NO 
-- ID                 NUMBER     NO   YES
-- TXT                VARCHAR2   NO   YES
Inserting some records into the table:
begin
   insert into tq84_a values (1, 'one'  );
   insert into tq84_a values (2, 'two'  );
   insert into tq84_a values (3, 'three');
   commit;
end;
/
One record is deleted …
delete from tq84_a where id = 2;
… another set for archival:
update tq84_a
set
   ora_archive_state = '1' -- = dbms_ilm.archiveStateName(dbms_ilm.archive_state_archived)
where
   id = 3;

commit;
I want to see the «active» records only:
alter session set row archival visibility = active;

select * from tq84_a;
--
--         ID TXT                 
-- ---------- --------------------
--          1 one                 
I want to see the archived records, too:
alter session set row archival visibility = all;

select * from tq84_a;
--
--         ID TXT                 
-- ---------- --------------------
--          1 one                 
--          3 three               
Cleaning up:
drop table tq84_a;

See also

The 48th bit of the property column in sys.tab$.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758205635, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/objects/tables/columns/in-database-archiving(108): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78