Saturday, May 2, 2009

Flashback

select * from hr.employees where employee_id=100

select * from hr.employees as of TIMESTAMP(systimestamp-10) where employee_id=100

EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID

---------------------- -------------------- ------------------------- ------------------------- -------------------- ------------------------- ---------- ---------------------- ---------------------- ---------------------- ----------------------

100 Steven King SKING 515.123.4567 17-JUN-87 AD_PRES 100 90



1 rows selected



EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID

---------------------- -------------------- ------------------------- ------------------------- -------------------- ------------------------- ---------- ---------------------- ---------------------- ---------------------- ----------------------

100 Steven King SKING 515.123.4567 17-JUN-87 AD_PRES 24000 90



1 rows selected



Flashback Table



[oracle@localhost ~]$ sqlplus hr/hr



SQL*Plus: Release 10.2.0.1.0 - Production on Fri Apr 10 08:45:52 2009



Copyright (c) 1982, 2005, Oracle. All rights reserved.





Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options



HR> create table hr.empt1 (id int);



Table created.



HR> insert into hr.empt1 values (1);



1 row created.



HR>

HR> drop table hr.empt1;



Table dropped.



HR> flashback table empt1 to before drop;



Flashback complete.



HR> select * from hr.empt1;

1



HR>

No comments:

Post a Comment