闪回数据归档的实验-oracle total recall
闪回数据归档:Oracle total recall ORACLE全面回忆功能。
ORACLE 11G提供的新功能。
通过这一功能ORACLE将UNDO数据进行归档,从而提供全面的历史数据查询。
类似归档日志,11G新增的后台进程FBDA(flashback data archiver process)用于对闪回数据进行归档写出。
ORACLE可以指定闪回归档数据保存时间,并可以通过内部分区和压缩算法减少空间使用。
闪回数据归档需要独立的存储,使用此特性前需要创建独立的ASSM表空间。
DDL不允许使用在被FBDA跟踪的table上(add column,rename和grant可以)。
开始实验:
1.建立FBDA进程所需表空间-FLASH BACK DATA ARCHIVE-闪回数据归档
21:44:32 SQL> create tablespace bys_flashback datafile '/u01/app/oracle/oradata/bys001/bys_flashback.dbf' size 10m autoextend off;
Tablespace created.
21:45:35 SQL> show user
USER is "SYS"
Default的FBDA需要用sysdba登陆才能建立,并且只能有一个Default的FBDA
21:45:39 SQL> create flashback archive default fbda1 tablespace bys_flashback retention 7 day;
Flashback archive created.
21:46:36 SQL> create flashback archive fbda2 tablespace bys_flashback quota 7m retention 10 day;
Flashback archive created.
2.创建表并指定闪回归档属性,记录DML操作前后SCN
21:47:52 SQL> conn bys/bys
Connected.
21:49:54 SQL> create table test6(abc varchar2(9)) flashback archive;
Table created.
对已经存在的表改变或取消表的闪回归档可以使用
alter table test6 flashback archive fbda2;--网上查的,创建的闪回归档表名?
alter table test6 no flashback archive;
插入数据,省略演示。
21:51:27 SQL> select * from test6;
ABC
---------
1
2
3
21:51:32 SQL> select current_scn from v$database;
CURRENT_SCN
-----------
1372223
21:51:44 SQL> delete from test6 where abc=3;
1 row deleted.
21:52:12 SQL> commit;
Commit complete.
21:52:14 SQL> host 这里的ALERT日志是从TRACE目录下源ALERT日志上做一个软链接,方便查看日志。
aa.t back1.sh Desktop
alert_bys001.log back2-20130623-1144.log fullback.sh
archback.sh back2.sh rmanlog
back0.sh cumulative
3.从alert日志中查看闪回归档表空间的创建及FBDA进程的启动
[oracle@oel-01 ~]$ tail alert_bys001.log
SUPLOG: unique = OFF, foreign key = OFF, all column = OFF
SUPLOG: procedural replication = OFF
Completed: alter database add supplemental log data
Sun Jun 23 21:45:33 2013
create tablespace bys_flashback datafile '/u01/app/oracle/oradata/bys001/bys_flashback.dbf' size 10m autoextend off
Completed: create tablespace bys_flashback datafile '/u01/app/oracle/oradata/bys001/bys_flashback.dbf' size 10m autoextend off
Sun Jun 23 21:46:36 2013
Starting background process FBDA
Sun Jun 23 21:46:36 2013
FBDA started with pid=33, OS id=3961
[oracle@oel-01 ~]$ exit
exit
21:54:08 SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS1
21:56:08 SQL> col name for a40
21:56:20 SQL> select file#,name from v$datafile where name like '%test%';
FILE# NAME
---------- ----------------------------------------
7 /u01/app/oracle/oradata/bys001/test1_undo.dbf
未使用此句:
drop tablespace undotbs1 including contents and datafiles;
相关阅读: