ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle11g flashback archive feature新特性

oracle11g flashback archive feature新特性

原创 Linux操作系统 作者:wisdomone1 时间:2013-04-01 20:17:53 0 删除 编辑

/******flashback archive*****/
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_1008.htm#SQLRF20009

http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_5010.htm#BABIAECC

/***示例*****/
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博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-757602/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: backup tool nbu
请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12690169