Let us we discuss about flashback concept /technology   what is flashback technology ? why we need that ? -Flashback  technology / query feature  was introduced from oracle 9i onwards from  Oracle 10g has taken this technology a step further making it simpler to use and much more flexible -It is used to recover our database from accidental statement failures like suppose delete the row from table or drop table or wrongly inserted new  rows and gives  commits it also then, using flash back query can get . -It depends upon undo retention time  period which we have mentioned in it  ex: if we mentioned UNDO_RETENTION parameter to 2 hours then, Oracle will not overwrite the data in undo tablespace even after committing until 2 Hours have passed. Users can recover from their mistakes made since last 2 hours only Types of Flashback -Flashback Query -Flashback Version Query -Flashback Transaction Query -Flashback Table -Flashback Drop (Recycle Bin) -Flashback Database  *Flashback Query -It allow the contents of  table to be queried with reference time stamp/SCN number . s-1: i ' m created a table ram from copy  of emp  table  belongs to  scott user

SQL>create table ram as select  * from emp;

  s-2: Insert the values from emp

SQL> insert into ram select * from emp;

14 rows created.

SQL> commit;

Commit complete.

  s-3: going to check table  whether values are  inserted or not

SQL> select * from ram;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                   20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300        30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500        30
      7566 JONES      MANAGER         7839 02-APR-81       2975                   20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400        30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                   30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                   10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                   20
      7839 KING       PRESIDENT            17-NOV-81       5000                   10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0        30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                   20
      7900 JAMES      CLERK           7698 03-DEC-81        950                   30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                   20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                   10

14 rows selected.

now from sysdba login check the  current_scn and timestamps

SQL> SELECT current_scn, TO_CHAR(SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS') FROM v$database;

CURRENT_SCN TO_CHAR(SYSTIMESTAM
----------- -------------------
     868159 2016-03-13 15:06:43

  s-4: now i'm deleting the row which  has empno=7900

SQL> delete from ram where empno='7900';

1 row deleted.

SQL> commit;

  check  my table  ram

SQL> select * from ram;
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                   20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300        30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500        30
      7566 JONES      MANAGER         7839 02-APR-81       2975                   20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400        30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                   30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                   10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                   20
      7839 KING       PRESIDENT            17-NOV-81       5000                   10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0        30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                   20
      7902 FORD       ANALYST         7566 03-DEC-81       3000                   20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                   10

13 rows selected.


  s-5: by using scn number  i ll check  the total rows in that table  

SQL> select count(*) from ram as of scn 868159;

  COUNT(*)
----------
        14

using timestamp

SQL>select count(*) from ram as of timestamp to_timestamp('2016-03-13 15:06:43','YYYY-MM-DD HH24:MI:SS');

COUNT(*)
----------
        14

  i'm going to flashback the table using timestamp  from scott user side   s-6 enable the row movement  is allow row flash back from und0_retention

SQL> alter table ram enable row movement;

Table altered.

  do flash back ram table

SQL> flashback table ram to timestamp to_timestamp('2016-03-13 15:06:43','YYYY-MM-DD HH24:MI:SS');

Flashback complete.

s-7 check my table rows

SQL> select * from ram;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                   20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300        30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500        30
      7566 JONES      MANAGER         7839 02-APR-81       2975                   20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400        30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                   30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                   10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                   20
      7839 KING       PRESIDENT            17-NOV-81       5000                   10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0        30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                   20
      7900 JAMES      CLERK           7698 03-DEC-81        950                   30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                   20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                   10

14 rows selected.

i can flash back my table for particular that time period