Beruflich Dokumente
Kultur Dokumente
FLASHBACK
Flashback
Flashback query
Flashback query versions
Flashback transaction query
Flashback table
Flashback Drop
Flashback Database
Flashback Query
EXECUTE
Dbms_Flashback.Enable_At_System_Change_Number(123);EXEC
UTE Dbms_Flashback.Enable_At_Time('28-AUG-01 11:00:00');
EXECUTE Dbms_Flashback.Disable;
Flashback Query Sample
Alter System Set undo_retention = 1200; (sys)
Shutdown immediate
Startup
Creamos una copia de la tabla para efectuar el ejemplo:
Create table Empleados as Select * from Emp; (scott)
Delete from Empleados Where Deptno = 10; (13-03-2015
11:16:04) 11:16:14 commit;
Select * from SCOTT.EMPLEADOS AS OF TIMESTAMP
TO_TIMESTAMP('13-03-2015 11:16:14')
Flashback Query
Ver que datos no se encuentran o fueron borrados de la otra
tabla:
Select * from EMPLEADOS AS OF TIMESTAMP TO_TIMESTAMP('13-03-
2009 11:16:14')
MINUS
Select * from EMPLEADOS
Restauramos la informacin en la tabla:
INSERT INTO EMPLEADOS
(Select * from EMPLEADOS AS OF TIMESTAMP TO_TIMESTAMP('13-03-
2009 11:16:14')
MINUS
Select * from EMPLEADOS)
Ejemplo
Guidelines for Oracle
Flashback Query
You can specify or omit the AS OF clause for each table and specify
different times for different tables.
You can use the AS OF clause in queries to perform DDL operations
(such as creating and truncating tables) or DML operations (such as
inserting and deleting) in the same session as Oracle Flashback Query.
To use the result of Oracle Flashback Query in a DDL or DML statement
that affects the current state of the database, use an AS OF clause
inside an INSERT or CREATE TABLE AS SELECT statement.
If a possible 3-second error (maximum) is important to Oracle Flashback
Query in your application, use an SCN instead of a timestamp. See
General Guidelines for Oracle Flashback Technology.
You can create a view that refers to past data by using the AS OF
clause in the SELECT statement that defines the view.
Guidelines for Oracle
Flashback Query
If you specify a relative time by subtracting from the current
time on the database host, the past time is recalculated for
each query. For example:
SHOW RECYCLEBIN
SELECT * FROM RECYCLEBIN
PURGE RECYCLEBIN
PURGE DBA_RECYCLEBIN
PURGE TABLE BIN$jsleilx392mk2=293$0;
PURGE TABLE employees;
PURGE TABLESPACE x USER y ;