Escolar Documentos
Profissional Documentos
Cultura Documentos
Database 10g
Oracle9i introduced the DBMS_FLASHBACK package to allow
queries to reference older versions of the database. Oracle 10g
has taken this technology a step further making it simpler to use
and much more flexible.
Note: Internally Oracle uses SCNs to track changes so any
flashback operation that uses a timestamp must be translated into
the nearest SCN which can result in a 3 second error.
Flashback Query
Flashback Version Query
Flashback Table
Flashback Database
Flashback Query
Flashback Query allows the contents of a table to be queried with
reference to a specific point in time, using the AS OF clause.
Essentially it is the same as the DBMS_FLASHBACK functionality
or Oracle9i, but in a more convenient form. For example:
CREATE TABLE flashback_query_test (
id NUMBER(10)
);
SCOTT
update "SCOTT"."FLASHBACK_VERSION_QUERY_TEST"
set "DESCRIPTION" = 'ONE' where ROWID =
'AAAMP9AAEAAAA
AYAAA';
0600030021000000 BEGIN
725208
725209
SCOTT
XID
OPERATION
START_SCN COMMIT_SCN
----------------------------------------------- ------------------LOGON_USER
-----------------------------UNDO_SQL
--------------------------------------------------------------------------------------------------
2 rows selected.
Flashback Table
The FLASHBACK TABLE command allows point in time recovery
of individual tables subject to the following requirements:
PURGE DBA_RECYCLEBIN;
whole recycle bin.
Several restrictions apply relating to the recycle bin:
-- The
Flashback Database
The FLASHBACK DATABASE command is a fast alternative to
performing an incomplete recovery. In order to flashback the
database you must have SYSDBA privilege and the flash recovery
area must have been prepared in advance.
If the database is in NOARCHIVELOG it must be switched to
ARCHIVELOG mode:
CONN sys/password AS SYSDBA
FROM
emp AS OF TIMESTAMP
SCN_TO_TIMESTAMP(993240);
DECLARE
l_scn
NUMBER;
l_timestamp TIMESTAMP;
BEGIN
l_scn
:= TIMESTAMP_TO_SCN(SYSTIMESTAMP 1/24);
l_timestamp := SCN_TO_TIMESTAMP(l_scn);
END;
/