flashback database.

 


1. setup

conn /as sysdba;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT EXCLUSIVE;
ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=90000 SCOPE=BOTH;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE FLASHBACK ON;
ALTER DATABASE OPEN;
PROMPT complete.


2. before operation,execute the follow sql and record the result:

SELECT flashback_on FROM v$database;
SELECT to_char(SYSDATE,'yyyy/mm/dd hh24:mi:ss') as current_time FROM dual;
SELECT CURRENT_SCN FROM V$DATABASE;
PROMPT complete.


 

3. after operation,replace the scn as the 1 step.

conn /as sysdba;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT EXCLUSIVE;
FLASHBACK DATABASE TO SCN 150400957; 
--or FLASHBACK DATABASE TO TIMESTAMP(to_date('20111130130000','yyyymmddhh24miss'));
alter database open resetlogs;
PROMPT complete.


4. deconfig

conn /as sysdba;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT EXCLUSIVE;
ALTER DATABASE FLASHBACK OFF;
ALTER DATABASE NOARCHIVELOG;
ALTER DATABASE OPEN;
PROMPT complete. 


你可能感兴趣的:(sql,Date,database,System)