Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

ora_archive_state Tips

Oracle Database Tips by Donald BurlesonSeptember 2, 2015


Starting in Oracle 12c, Oracle provides a new feature that allow you to "logically delete" a row in a table without physically removing the row.  This effectively makes deleted rows "invisible" to all SQL and DML, but they can be revealed at any time, providing a sort of "instant" rollback method.

 

To use ora_archive_state as an alternative to deleting rows, you need the following settings and parameters:

 

1. Create the table with the row archival clause

 

      create table mytab (col1 number, col2 char(200)) row archival;

 

2.  Now that the table is marked as row archival, you have two methods for removing rows, a permanent solution with the standard delete DML, plus the new syntax where you set ora_archive_state to a non-zero value:

 

      update mytab set ora_archive_state=2 where col2='FRED';  

 

3.  To make "invisible rows" visible again, you simply set the rows ora_archive_state to zero:

 

      update mytab set ora_archive_state=0 where col2='FRED';  

 

To see rows that are marked as deleted you can select the pseudo-column ora_archive_state from a table, just as-if it were a real table column.  This is a binary pseudo-column, and a "1" value indicates a logically deleted table row.

 

   select id, col1, col2, ora_archive_state from mytab;

Removing row invisibility

Below we see a case where we set the row archival visibility parameter to "all" thereby allowing us to see all of the rows that have been logically deleted:

   alter session set row archival visibility = all;

   select col1, col2, ora_archive_state from mytab;

We can then turn-on row invisibility back on by changing row archival visibility = "active":

   alter session set row archival visibility = all;

We also see two new data dictionary columns in dba_tab_cols, hidden_column (an indicator) and user_generated:

select
   table_name,
   column_name,
   hidden_column,
   user_generated
from
   dba_tab_cols
where
   table_name='MYTAB';

   
Oracle Training from Don Burleson 

The best on site "Oracle training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

Oracle training
 
 


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster