[bbk4795] 第37集 - 第四章 Flashback Database 01
数据归档区管理员(FLASHBACK ARCHIVE ADMINISTER)
在日常管理中,可以安排一个专门人员负责数据归档区的管理.DBA分配FLASHBACK ARCHIVE ADMINISTER权限给此用户.
空间
TABLESPACE
权限
|-SELECT ANY TRANSACTION
|-FALASHBACK ARCHI
|-DBMS_FLASHBACK(PACKAGE EXECUTE PRIVES)
How Total Recall Works
History data:
- Row captured asynchronously by background processes at selft-tuned intervals(default:5 min)
- Stored compressed and partitioned
- Automatically purged per retention policy
- Partitions automatically created based on time and volume
- Unrelated partitions skipped by queries
Step Process
1、Create a new database to hold the FDA
2、With the FLASHBACK ARCHIVE ADMINISTER system privilege:Create a Flashback Data Archive,assign it to the tablespace,and specify its retention period.
CREATE FLASHBACK ARCHIVE fda1 TABLESPACE fda_tbs1 QUOTA 10M RETENTION 1 YEAR;
3、With the FLASHBACK ARCHIVE object privilege:Alter the base tables to enable archiving and assign it to a flashback archive.
ALTER TABLE HR.EMPLOYEES FLASHBACK ARCHIVE fda1;
Oracle Total Recall Scenario
Using Flashback Data Archive to access historical data:
--create the Flashback Data Archive CREATE FLASHBACK ARCHIVE DEFAULT fla1 TABLESPACE tbs1 QUOTA 10G RETENTION 5 YEAR;
--Specify the default Flashback Data Archive ALTER FLASHBACK ARCHIVE fla1 SET DEFAULT;
--Enable Flashback Data Archive ALTER TABLE inventory FLASHBACK ARCHIVE; ALTER TABLE stock_data FLASHBACK ARCHIVE;
SELECT product_number,product_name,count FROM inventory AS OF TIMESTAMP TO_TIMESTAMP('20017-01-01 00:00:00','YYYY:MM-DD HH24:MI:SS');