oracle11g flashback archive feature新特性

wisdomone1發表於2013-04-01

/******flashback archive*****/

/***示例*****/
SQL> create flashback archive test_flashback tablespace tbs_16k quota 100 M retention 1 day;
 
Done
 
SQL> create table t_flashback(a int);
 
Table created
 
SQL> insert into t_flashback values(1);
 
1 row inserted
 
SQL> commit;
 
Commit complete
 
SQL> select current_scn from v$database;
 
CURRENT_SCN
-----------
   11451980

/***此語法僅適用於預設的flashback archive****/
SQL> alter table t_flashback flashback archive;
 
alter table t_flashback flashback archive
 
ORA-55608: Default Flashback Archive does not exist

/*** 指定flashback archive***/
SQL> alter table t_flashback flashback archive test_flashback;
 
Table altered
 
SQL> insert into t_flashback  values(2);
 
1 row inserted
 
SQL> commit;
 
Commit complete
 
/***flashback to before time***/
SQL> select * from t_flashback  as of scn 11451980;
 
                                      A
---------------------------------------
                                      1
 
SQL> select current_scn from v$database;
 
CURRENT_SCN
-----------
   11452186

/***ddl操作*****/
SQL> alter table t_flashback add b int;
 
Table altered
 
SQL> select * from t_flashback;
 
                                      A                                       B
--------------------------------------- ---------------------------------------
                                      1
                                      2
/***cross ddl依舊可以flashback to before time*****/
SQL> select * from t_flashback  as of scn 11451980;
 
         A
----------
         1
 

/***下附一些各項操作語法****/
The next statement alters the default flashback data archive to extend the retention period to 1 month:
 ALTER FLASHBACK ARCHIVE test_archive1
   MODIFY RETENTION 1 MONTH;
 
The next statement specifies tracking for the oe.customers table. The flashback data archive is not specified, so data will be archived in the default flashback data archive, test_archive1:
 ALTER TABLE oe.customers
   FLASHBACK ARCHIVE;
 
The next statement specifies tracking for the oe.orders table. In this case, data will be archived in the specified flashback data archive, test_archive2:
 ALTER TABLE oe.orders
   FLASHBACK ARCHIVE test_archive2;
 
The next statement drops test_archive2 flashback data archive:
 DROP FLASHBACK ARCHIVE test_archive2

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-757602/,如需轉載,請註明出處,否則將追究法律責任。

相關文章