Home > Database > Mysql Tutorial > Create Flashback Archive目前还不支持12.1 CDB ?

Create Flashback Archive目前还不支持12.1 CDB ?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:00:08
Original
1146 people have browsed it

使用CREATE FLASHBACK ARCHIVE语句来创建一个闪回数据归档(flashback data archive),可以自动对数据库中的对象记录和归档事务数

使用CREATE FLASHBACK ARCHIVE语句来创建一个闪回数据归档(flashback data archive),可以自动对数据库中的对象记录和归档事务数据变化。

闪回数据归档包含多个表空间并且保存被追踪表的所有历史事务。 这些数据保存在间隔历史表中。

闪回数据归档使用RETENTION参数来指定保存期限。历史数据可以使用闪回查询语句as of字句查询。超过历史期限的数据自动被清理掉。

创建闪回数据归档需要具有FLASHBACK ARCHIVE ADMINISTER的系统权限。 另外还需要在创建表空间时为保留历史数据保留足够大的陪额空间。

以上解释摘录Oracle官方文档。

用工作中的一个案例可以很容易的解释它的用处。我在银行工作,,审计部门会时常要求我们提供某月某时的数据泵导出文件来审核。比如今天是2015年5月3日,早上一打开邮箱就收审计部门的邮件,要求提供2015年4月1日早上7:00整的某些表数据。整整一个月前的数据,现在才通知... 通常这种情况我们需要使用NBU备份恢复到4月1日凌晨的那次全备,然后再恢复出归档日志,最后按照7:00这个时间来执行一次不完全恢复。恢复完成后再使用数据泵导出部分需要审计的表。当然所有的工作都是在测试数据库来完成的。

如果使用Oracle的flashback archive来记录这些被审计的表,我们就不用这么折腾了。每次接到审计工作要求,只需要使用select .. as of就可以找回1个月前的数据。

下面来看看具体操作的例子:

1. 创建一个表空间flash_tbs用来保存闪回数据归档

create table flash_tbs datafile '/dbfile/flash_tbs.dbf' size 100m autoextend on;

2. 创建一个用户flash_admin,分配FLASHBACK ARCHIVE ADMINISTER权限

grant dba,flashback archive administer to flash_admin identified by oracle;

3. 使用flash_admin创建一个名为my_flash的闪回数据归档对象,将数据保存在flash_tbs为期1年

conn flash_admin/oracle

create flashback archive my_flash tablespace flash_tbs quota 50m retention 1 year;

4. 将sh.employee表的数据变化记录到my_flash

alter table hr.employees flashback archive my_flash

完成以上4步,表employees产生的变化就会向表空间flash_tbs记录。即使undo表空间中断数据被清空了,及时归档日志已经被NBU备份后清理了,在flash_tbs中依然保存着employees的数据变化,保存期为1年。在这一年有效期内,可以闪回查询到创建flashback archive之后任何一个时间点。

可惜的是目前该功能不支持12c的CDB, 创建flashback archive会提示not supported in a pluggable database

[oracle@snow ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Mon Apr 20 13:54:49 2015

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

> alter session set container=pdb1;

Session altered.

> create tablespace flash_tbs datafile '/home/oracle/dbfile/cdb/pdb1/flash_tbs.dbf' size 100m autoextend on;

Tablespace created.

> grant dba,flashback archive administer to flash_admin identified by oracle;

Grant succeeded.

> conn

Connected.

> create flashback archive my_flash tablespace flash_tbs quota 50m retention 1 year;

create flashback archive my_flash tablespace flash_tbs quota 50m retention 1 year

*

ERROR at line 1:

ORA-65131: The feature Flashback Data Archive is not supported in a pluggable

database.

在 站点上找到了相同的期盼声音

Flashback archive is supported in 12c but not in the multi-tenant CDB architecture. We will have to wait for 12.2 it appears.

全文完

本文永久更新链接地址

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template