Pages

Search This Blog ...

Monday, April 4, 2016

What is Flashback Version Query In Oracle 11g R2

In this tutorial i'll show you how Oracle Flashback Technology works and as well as inside how to use flashback version query.

In Oracle there are Seven Technology as given below.
   In the Flashback Technology, It include database related group of features that manage a state of your data in the database.

   This Technology works on the undo data so you can get all those transaction, query as well as data from undo segments thus, your can recovery your data which had been lost or damage as well as you can see the query which had been perform on a specific time or SCN. 
  1. Flashback Query.
  2. Flashback Transaction.
  3. Flashback Transaction Query
  4. Flashback Version Query.
  5. Flashback Table.
  6. Flashback Database.
  7. Flashback Data Archive [ Total Recall ]. 
 Some few advantages given below,
  • See the query had been perform.
  • See the transaction information.
  • See the past state data.
  • You can perform rollback entire table without performing database recovery.
  • If you delete or drop the table by mistake and you perform DDL or commit without knowing the previous transaction.  and so on...
Here i'll be show you 4th  Flashback Version Query as below,

    In this Technology you can see all the of two row between two times.
    And you can also see the transaction that change the row.

    The Flashback Version Query enable you to use the VERSIONS clause to retrieve all version of all the row that exist between two point in times or SCN no.
    This technology only retrieves those data which has been committed and you can't retrieve without committed data.
    You can use this technology to retrieve row history
    Version Query use undo data but you can not modify data.

Note
     The VERSIONS_XID is a pseudocolumn that returns the transaction id of the corresponding version of row.

The VERSION clause can not work as below,
  • Temporary Table
  • Fixed Table
  • External Table
  • Views
 Syntax as below,

VERSIONS {BETWEEN {SCN | TIMESTAMP} start AND end}

Example as below,

SELECT versions_startscn, versions_starttime,
       versions_endscn, versions_endtime,
       versions_xid, versions_operation,
       last_name, salary
  FROM employees
  VERSIONS BETWEEN TIMESTAMP
      TO_TIMESTAMP('2016-12-18 14:00:00', 'YYYY-MM-DD HH24:MI:SS')
  AND TO_TIMESTAMP('2016-12-18 17:00:00', 'YYYY-MM-DD HH24:MI:SS')
  WHERE first_name = 'John';


That's was a Flashback Version Query in Oracle 11g,

No comments:

Post a Comment

Thank you for give me feedback : )