Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

   
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

 

Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation

 

 


 

 

 


        
 
   Oracle Tips by Burleson

Oracle10g Row Timestamp

 

Oracle Database 10g provides a new pseudo-column, consisting of the committed timestamp or SCN that provides applications and users the ability to efficiently implement optimistic locking. In previous releases, when posting updates to the database, applications had to read in all column values or user-specified indicator columns, compare them with those previously fetched, and update those with identical values. With this feature, only the row SCN needs to be retrieved and compared to verify that the row has not changed from the time of the select to the update.

The pseudo-column for the committed SCN is called ora_rowscn and is one of the version query pseudo-columns.

The ora_rowscn pseudo-column returns, for each version of each row, the system change number (SCN) of the row. You cannot use this pseudo-column in a query to a view.

However, you can use it to refer to the underlying table when creating a view. You can also use this pseudo-column in the WHERE clause of an UPDATE or DELETE statement.

Even though this pseudo-column is grouped with the restricted version query pseudo-columns, this pseudo-column can be used like any other pseudo-column. For example:

SQL> SELECT ora_rowscn FROM used_boats:

ORA_ROWSCN
----------
791744
791744
791744
791744
791744
791744
791744
791744
791744
791744
791744
791744
791744
791744

13 rows selected.

The above query shows us that all of the records in used_boats were committed in the same transaction. Let's update some of the rows and see what happens.

SQL> UPDATE used_boats SET price=price*1.1 WHERE seller_id=1;

3 rows updated.

SQL> commit;

Commit complete

SQL> SELECT ora_rowscn FROM used_boats:

ORA_ROWSCN
----------
816673
816673
816673
791744
791744
791744
791744
791744
791744
791744
791744
791744
791744
791744

13 rows selected.

Another convenient function allows you to retrieve the actual time that the row was last altered through a conversion function called scn_to_timestamp. Let's look at an example usage of this function.

SQL> select scn_to_timestamp(ora_rowscn) from used_boats;


SCN_TO_TIMESTAMP(ORA_ROWSCN)
30-AUG-03 11.06.08.000000000 PM
30-AUG-03 11.06.08.000000000 PM
30-AUG-03 11.06.08.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM
30-AUG-03 04.33.19.000000000 PM

13 rows selected.

The ora_rowscn has the following restrictions: This pseudo-column is not supported for external tables or when directly querying views.

The data from the SCN and timestamp pseudo-columns could prove invaluable in a flashback situation.
 


Get the complete Oracle Tuning story from Rampant TechPress

http://www.rampant-books.com/book_0214_oracle_tuning_definitive_reference_3rd_ed.htm


Expert Remote DBA

BC is America's oldest and largest Remote DBA Oracle support provider.  Get real Remote DBA experts, call
BC Remote DBA today.

Remote DBA Service
 

Oracle Tuning Book

 

Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

 

 

 

 

 

 

BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2016 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.