閃回資料歸檔-- Flashback Data Archive
閃回資料歸檔是oracle 11g的特性之一,如果對某個物件(表)使用該功能,那麼從功能啟用開始,針對該物件的所有事務修改都會保留一段時間,
透過 select as of timestamp 查詢 到特定時期的歷史資料。
Purpose
- What is FDA (Flashback Data Archive) ?
- How to enable Flashback Data Archive features?
- What is the role of the new background process FBDA?
- What is the Flashback Data Archive Workflow an Example?
- How to configure a Default Flashback Data Archive as Example?
Scope
This feature can be used by DBA's and Support Analysts to understand and
configure Flashback Data Archive
Details
A new database object, a flashback data archive is a logical
container for storing historical information. It is stored in one or
more tablespaces and tracks the history for one or more tables.
You specify retention duration for each flashback data archive (could be # of years).
SQL> create flashback archive fla1 tablespace tbs1 retention 2 year;
With the "Oracle Total Recall" option, Oracle database 11g has been
specifically enhanced to track history with minimal performance impact
and to store historical data in compressed form to minimize storage
requirements, completely transparent to applications, easy to setup .
This efficiency cannot be duplicated by your own triggers, which also
cost time and effort to set up and maintain.
To satisfy long-retention requirements that exceed the undo retention, create a flashback data archive.
To satisfy long-retention requirements, use flashback data archives. Begin with the following steps:
# For your archive administrator:
1:?? Create one or more tablespaces for data archives and grant QUOTA on the tablespaces.
2:?? Grant the FLASHBACK ARCHIVE ADMINISTER system privilege to create and maintain flashback archives.
# For archive users:
Grant the FLASHBACK ARCHIVE object privilege (to enable history tracking for specific tables in the given flashback archives).
>SCOTT (Archive user)
SQL> alter table emp flashback archive fla1;
alter table emp flashback archive fla1
*
ERROR at line 1:
ORA-55620: No privilege to use Flashback Archive
As SYS use or Archive Administrator (who granted FLASHBACK ARCHIVE ADMINISTER system privilege)
SQL> grant flashback archive on fla1 to scott;
Grant succeeded
Note:
Grant the FLASHBACK ARCHIVE ADMINISTER system privilege to your archive
administrator,to allow execution of the following statements:
- CREATE FLASHBACK ARCHIVE
- ALTER FLASHBACK ARCHIVE
- DROP FLASHBACK ARCHIVE
The Flashback Data Archive background process, FBDA, starts with the database.
1. FBDA operates first on the undo in the buffer cache.
2. In case the undo has already left the buffer cache, FBDA could also read the required values from the undo segments.
3. FBDA consolidates the modified rows of flashback archive???enabled
tables and writes them into the appropriate history tables, which make
up the flashback data
archive.
You can find the internally
assigned names of the history tables by querying the
*_FLASHBACK_ARCHIVE_TABLES view. History tables are compressed and
internally partitioned. The database automatically purges all historical
information on the day after the retention period expires. (It deletes
the data, but does not destroy the flashback data archive.) For example,
if the retention period is 10 days, then every day after the tenth day,
the oldest information is deleted; thus
leaving only 10 days of information in the archive. This is a way to implement digital shredding.
1. Create the flashback data archive:
The archive administrator creates a flashback data archive named fla1,
which uses up to unlimited of the tbs1 tablespace and whose data will be
retained for two years. If you want to set up your database so that
information in the fla1 is automatically deleted, the day after 2 years
is complete.
SQL> create flashback archive fla1 tablespace tbs1 retention 2 year; << data will be retained for 2 years.!
Flashback archive created.
2- Grant Flashback Archive objects privilege on Flashback data archive (fla1) to Archive User (SCOTT).
SQL> grant flashback archive on fla1 to Scott;
Grant succeeded
3- Enable history tracking for a table in the FLA1 archive:
????As Flashback Archive User (SCOTT)
SQL> alter table EMP flashback archive fla1;
Table altered.
4- View the historical data:
SQL> select to_timestamp(sysdate) from dual;
TO_TIMESTAMP(SYSDATE)
---------------------------------------------------------------------------
02-DEC-07 12.00.00 AM
SQL> alter table EMP flashback archive fla1;
Table altered.
SQL> update emp set sal=sal+100 where empno=7788;
1 row updated.
SQL> select sal from emp as of timestamp to_timestamp('2007-12-02 00:00:00','yyyy-mm-dd hh24:mi:ss') 3 where empno=7788;
SAL
----------
3100
SQL> select sal from emp where empno=7788;
SAL
----------
3200
Note:
To use the flashback_archive_clause to enable/disable historical
tracking for the table, you must have the FLASHBACK ARCHIVE ADMINISTER
system privilege or you must be logged in as SYSDBA.
Flashback
archiving is handled by fbda background process, and it checks for
tablespace quota every 1 hour. If you run out of flashback archival
space and must extend the tablespace you may also need to reset the
quota for the tablespace.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21754115/viewspace-1143020/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11g新特性--閃回資料歸檔(flashback data archive)[zt]OracleHive
- Oracle Flashback Archive——Oracle閃迴歸檔(上)OracleHive
- Oracle Flashback Archive——Oracle閃迴歸檔(中)OracleHive
- Oracle Flashback Archive——Oracle閃迴歸檔(下)OracleHive
- 【Flashback】11g的閃回資料歸檔初探
- Oracle閃回資料歸檔Oracle
- flashback query閃回資料
- 【Flashback】啟用閃回資料庫功能需要在歸檔模式下完成資料庫模式
- 清除閃回資料歸檔區資料
- Oracle Flashback Data ArchiveOracleHive
- Flashback Data Archive RequirementsHiveUIREM
- Flashback Database 閃回資料庫Database資料庫
- 11g閃回資料歸檔
- [Flashback]Flashback Database閃回資料庫實驗Database資料庫
- 【FLASHBACK】Oracle flashback data archive 介紹OracleHive
- 11G flashback data archive 導致產生大量歸檔日誌Hive
- 利用flashback閃回表和資料
- 【Flashback】Flashback Database閃回資料庫功能實驗Database資料庫
- 【Flashback】啟用Flashback Database閃回資料庫功能Database資料庫
- 【Flashback】Flashback Database閃回資料庫功能實踐Database資料庫
- Oracle 11g 閃回資料歸檔Oracle
- FlashBack總結之閃回資料庫與閃回刪除資料庫
- [zt] Oracle 11g 閃回資料歸檔Oracle
- Flashback Data Archive原理詳解Hive
- Flashback Data Archive (Oracle Total Recall)HiveOracle
- 開閃回及閃迴歸檔
- [Flashback]開啟資料庫閃回資料庫功能資料庫
- oracle 閃回 flashbackOracle
- 閃回資料庫(flashback database)知識分享資料庫Database
- 關於oracle閃回資料歸檔的總結Oracle
- Flashback閃回技術
- 【Flashback】使用檢視快速獲得Flashback Query閃回查詢資料
- 啟用Flashback Database閃回資料庫功能(閃回區滿解決辦法 )Database資料庫
- RAC資料庫啟用歸檔和閃回的步驟資料庫
- Oracle 11g閃回資料歸檔新功能解析Oracle
- 閃回資料庫時間視窗(flashback database window)資料庫Database
- 第5章 閃回資料庫Understanding the Flashback Database資料庫Database
- 【Flashback】使用Flashback Drop技術閃回被DROP表的指定版本資料