Powered By Blogger

Thursday, January 27, 2011

Flashback version query Oracle 10g

********************** Flashback version query ********************

VERSIONS BETWEEN TIMESTAMP [lower bound] AND [upper bound]; or
VERSIONS BETWEEN SCN [lower bound] AND [lower bound].

The lower and upper boundaries can either be specific timestamps/SCNs or the keywords MINVALUE and MAXVALUE. These keywords instruct Oracle to retrieve all available data versions. The age of the data available is determined by the undo_retention parameter. For our first flashback version query, we will attempt to retrieve all available data.

********* CODE *********

sql>col versions_starttime format a25
sql>col versions_endtime format a25
sql>insert into c values(11);
sql>commit;
sql> select versions_starttime, versions_endtime, versions_xid,versions_operation,no from c versions between timestamp minvalue and maxvalue;

select VERSIONS_STARTSCN,VERSIONS_ENDSCN,VERSIONS_XID,VERSIONS_OPERATION,no from c versions between scn minvalue and maxvalue;

>>>> Oracle inbuilt function HEXTORAW converts char containing hexadecimal digits in the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 character set to a raw value

select * from FLASHBACK_TRANSACTION_QUERY WHERE XID =hextoraw('03001800BC010000');

No comments:

Post a Comment