FlashBack Query :
It is used to retrive the data in past , point in time at Query Level.
SQL> show user;
USER is "HAMEED"
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
INFO TABLE
SQL> set time on
20:57:11 SQL> select * from info;
ID NAME
------ ----------
1 A
2 B
3 C
20:57:19 SQL> select sysdate from dual;
SYSDATE
---------
31-DEC-16
21:01:22 SQL> update info set name='AAA' where id='1';
1 row updated.
21:01:49 SQL> commit;
Commit complete.
21:03:23 SQL> select * from info;
ID NAME
-----------------------
1 AAA
2 B
3 C
21:03:34 SQL> select * from info as of timestamp to_timestamp('31-DEC-16 21:01:22', 'dd-mon-rr hh24:mi:ss') where id=1;
ID NAME
-------------------
1 A
21:04:05 SQL> update info set name=(select name from info as of timestamp to_timestamp ('31-DEC-16 21:01:22', 'dd-mon-rr hh24:mi:ss') where id=1) where id=1;
1 row updated.
21:05:15 SQL> select * from info;
ID NAME
-----------------------
1 A
2 B
3 C
21:16:53 SQL> commit;
Commit complete.
It is used to retrive the data in past , point in time at Query Level.
SQL> show user;
USER is "HAMEED"
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
INFO TABLE
SQL> set time on
20:57:11 SQL> select * from info;
ID NAME
------ ----------
1 A
2 B
3 C
20:57:19 SQL> select sysdate from dual;
SYSDATE
---------
31-DEC-16
21:01:22 SQL> update info set name='AAA' where id='1';
1 row updated.
21:01:49 SQL> commit;
Commit complete.
21:03:23 SQL> select * from info;
ID NAME
-----------------------
1 AAA
2 B
3 C
21:03:34 SQL> select * from info as of timestamp to_timestamp('31-DEC-16 21:01:22', 'dd-mon-rr hh24:mi:ss') where id=1;
ID NAME
-------------------
1 A
21:04:05 SQL> update info set name=(select name from info as of timestamp to_timestamp ('31-DEC-16 21:01:22', 'dd-mon-rr hh24:mi:ss') where id=1) where id=1;
1 row updated.
21:05:15 SQL> select * from info;
ID NAME
-----------------------
1 A
2 B
3 C
21:16:53 SQL> commit;
Commit complete.
0 comments:
Post a Comment