标签:
a) Database must be in archivelog mode.
b) Last clean shutdown.
参数 | 属性 | 解释 |
---|---|---|
DB_RECOVERY_FILE_DEST | dynamically modifiable | Physical location where RVWR background process writes flashback logs |
DB_RECOVERY_FILE_DEST_SIZE | dynamically modifiable | Maximum size flashback logs can occupy in |
DB_RECOVERY_FILE_DESTDB_FLASHBACK_RETENTION_TARGET | dynamically modifiable | Upper limit in minutes on how far back one can flashback the database |
\**db_recovery_file_dest参数为0时,不能设定flash_recovery_area参数*\
SQL> alter system set db_recovery_file_dest_size=2147483648 scope=spfile;
SQL> alter system set db_recovery_file_dest=‘/u01/app/oracle/flash_recovery_area‘ scope=spfile;
SQL> alter system set DB_FLASHBACK_RETENTION_TARGET=2880; (2 days) |
SQL> Startup mount exclusive;
SQL> alter database archivelog;
SQL> Alter database flashback on;
SQL> Alter database open; |
SQL> SELECT flashback_on, log_mode FROM gv$database;
SQL> SELECT estimated_flashback_size FROM gv$flashback_database_log;
$ ps -eaf | grep rvwr |
Alter database flashback on;
1.使用SQLPLUS
SQL> shutdown immediate;
SQL> startup mount exclusive;
SQL> flashback database to timestamp(sysdate-1);
SQL> alter database open resetlogs;
2.使用 RMAN
RMAN> FLASHBACK DATABASE TO TIME = TO_DATE(‘2002-12-10 16:00:00‘,‘YYYY-MM-DD HH24:MI:SS‘);
RMAN> FLASHBACK DATABASE TO SCN=23565;
RMAN> FLASHBACK DATABASE TO SEQUENCE=223 THREAD=1;
SQL> SELECT oldest_flashback_scn,oldest_flashback_time FROM V
- Determine the current flashback window:
SQL> select to_char(end_time,‘yyyy-mm-dd hh:miAM‘) end_timestamp, flashback_data, db_data, redo_data from v$flashback_database_stat where rownum=1;
SQL> ALTER TABLESPACE <ts_name> FLASHBACK {ON|OFF}
SQL> SELECT name, flashback_on 2 FROM v$tablespace;
Note
可以闪回到resetlogs之前的一个时间点
SQL> FLASHBACK DATABASE TO BEFORE RESETLOGS;
You cannot use Flashback Database in the following situations:
The control file has been restored or re-created.
闪回数据库的一些命令:
\**闪回到指定的日期**\
FLASHBACK DATABASE TO TIMESTAMP(to_data(‘2015.07.11 20:03:00‘,‘YYYY.MM.DD HH24:MI:SS‘));
\**闪回到5分钟之前**\
FLASHBACK DATABASE TO TIMESTAMP SYSDATE-(1/24/12);
FLASHBACK DATABASE TO BEFORE TIMESTAMP my_date;
\**回退到过去的某个SCN点**\
FLASHBACK DATABASE TO SCN my_scn;
FLASHBACK DATABASE TO BEFORE SCN my_scn;
\**回退到某个Log Sequence号*\
flashback database to sequence=223 thread=1;
\**回退完成之后以resetlogs的方式打开数据库*\
alter database open resetlogs;
\**也可以创建一个恢复点*\
CREATE RESTORE POINT before_changes;
FLASHBACK DATABASE TO RESTORE POINT before_changes;
标签:
原文地址:http://www.cnblogs.com/haoxiaoyu/p/24eab1b4c44b3516d8061eb9d56d4675.html