可以看到每个还原点的名称,SCN,时间和还原点创建时的数据库对应化身的序列号,是正常还原点还是受保护还原点,以及为了提供足够的信息来支持闪回数据库操作该还原点在闪回区所使用的空间大小。
可以使用只查询受保护的还原点信息:
SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,
GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE
FROM V$RESTORE_POINT
WHERE GUARANTEE_FLASHBACK_DATABASE='YES';
SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,
2 GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE
3 FROM V$RESTORE_POINT
4 WHERE GUARANTEE_FLASHBACK_DATABASE='YES';
NAME SCN TIME DATABASE_INCARNATION# GUARANTEE_FLASHBACK_DATABASE STORAGE_SIZE
-------------------- ---------- --------------------------------------------------------------------------- --------------------- ------------------------------ ------------
BEFORE_TRUNCATE 2849315 27-JAN-15 02.40.56.000000000 PM 2 YES 8192000
对于正常还原点,storage_size为0。对于受保护的还原点storage_size指示了为了保证能对还原点执行flashback database操作所要保留日志所消耗的闪回区的空间大小。
下面的正常还原点的storage_size确实为0:
SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,
2 GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE
3 FROM V$RESTORE_POINT
4 WHERE GUARANTEE_FLASHBACK_DATABASE='YES';
NAME SCN TIME DATABASE_INCARNATION# GUARANTEE_FLASHBACK_DATABASE STORAGE_SIZE
-------------------- ---------- --------------------------------------------------------------------------- --------------------- ------------------------------ ------------
BEFORE_TRUNCATE 2849315 27-JAN-15 02.40.56.000000000 PM 2 YES 8192000
SQL> select count(*) from tt;
COUNT(*)
----------
51281
SQL> truncate table tt;
Table truncated.
SQL> select count(*) from tt;
COUNT(*)
----------
0
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 327155712 bytes
Fixed Size 1273516 bytes
Variable Size 138412372 bytes
Database Buffers 184549376 bytes
Redo Buffers 2920448 bytes
Database mounted.
SQL> select open_mode from v$database;
OPEN_MODE
----------
MOUNTED
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
RESTORE POINT ONLY
SQL> flashback database to restore point before_truncate;
Flashback complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> select count(*) from tt;
COUNT(*)
----------
51281
Oracle 11g flashback Data Archive(闪回数据归档)
Oracle flashback闪回机制