How To Using Flashback Data Archive (Oracle Total Recall)
At first,A Flashback Data Archive provides the ability to track and store transactional changes to a table over its lifetime. A Flashback Data Archive is useful for compliance with record stage policies and audit reports.
A Flashback Data Archive consists of one or more tablespaces or parts thereof. You can have multiple Flashback Data Archives. If you are logged on as SYSDBA, you can specify a default Flashback Data Archive for the system. A Flashback Data Archive is configured with retention time. Data archived in the Flashback Data Archive is retained for the retention time.By default, flashback archiving is off for any table. You can enable flashback archiving for a table if all of these conditions are true:
-
You have the FLASHBACK ARCHIVE object privilege on the Flashback Data Archive to use for that table.
-
The table is neither nested, clustered, temporary, remote, or external.
-
The table contains neither LONG nor nested columns.
-
The table does not use any of these Flashback Data Archive reserved words as column names:
-
STARTSCN
-
ENDSCN
-
RID
-
XID
-
OP
-
OPERATION
After flashback archiving is enabled for a table, you can disable it only if you either have the FLASHBACK ARCHIVE ADMINISTER system privilege or you are logged on as SYSDBA.When choosing a Flashback Data Archive for a specific table, consider the data retention requirements for the table and the retention times of the Flashback Data Archives on which you have the FLASHBACK ARCHIVE object privilege.
-
Most of the flashback functionalities rely on UNDO data which will error out with an ORA-1555 snapshot too old if the required before image cannot be read any more. ORA-1555 occurs because it has already been overwritten in the undo tablespace. Furthermore, it is very unlikely that the old values can be reconstructed over a longer period of time, like months or even years, from data stored in the undo segments.
Luckily, this UNDO data time issue can now be remedied. With the flashback data archive functionality of 11g the Oracle database is capable of automatically tracking transactional changes to data over very long periods. Oracle achieves this by storing UNDO information in special segments within dedicated tablespaces.
The usage of this feature is completely transparent for the application and the end user, who can view historical data from the flashback archive seamlessly with regular SQL statements. This is done by utilizing traditional flashback functionalities, such as flashback query, flashback versions query, flashback transaction query, etc.
The historical information in the flashback data archive ages out automatically and Oracle automatically purges it after the specified retention period has exceeded. However, the flashback data archive provides the DBA with a central interface for the management of historical data and change tracking.
% With a flashback data archive it is possible to view data as any point in time since the flashback data archive was created. However, attempting to view data as a timestamp before the data archive is created causes the following error: ORA-01466: unable to read data - table definition has changed
The technology behind flashback data archive
With every Oracle 11g database startup, the new flashback data archiver background process, FBDA, is automatically started. This is what generates and archives the historical data.
Transactions encounter very little performance impact from flashback data archiving because Oracle only marks DML operations as candidates for archiving. A special background process then generates and archives the history information asynchronously for tables enabled for flashback archival.
SQL> SELECT PNAME
2 FROM V$PROCESS
3 WHERE PNAME IS NOT NULL
4 ORDER BY PNAME;
...........
FBDA
[root@ORACLERAC2 ~]# ps -ef|grep fbda
oracle 1719 1 0 11:03 ? 00:00:00 ora_fbda_PROD1
root 25475 25409 0 17:47 pts/4 00:00:00 grep fbda
[root@ORACLERAC2 ~]#
...........
SQL> conn / as sysdba;
Connected.
SQL> create tablespace fratas datafile '/u01/app/oracle/oradata/PROD1/fratbs.dbf' size 50m;
Tablespace created.
SQL> create user fr_admin identified by fr_admin default tablespace fratas;
User created.
SQL>
SQL>
SQL> grant connect,resource to fr_admin;
Grant succeeded.
SQL> grant flashback archive administer to fr_admin;
Grant succeeded.
SQL> select PRIVILEGE from dba_sys_privs where PRIVILEGE like '%FLASHBACK%';
PRIVILEGE
----------------------------------------
FLASHBACK ANY TABLE
FLASHBACK ANY TABLE
FLASHBACK ARCHIVE ADMINISTER
FLASHBACK ARCHIVE ADMINISTER
FLASHBACK ARCHIVE ADMINISTER
FLASHBACK ANY TABLE
6 rows selected.
SQL> conn fr_admin/fr_admin
Connected.
SQL> CREATE FLASHBACK ARCHIVE fra1 tablespace fratas RETENTION 1 YEAR;
Flashback archive created.
SQL> desc dba_flashback_archive;
Name Null? Type
----------------------------------------- -------- ----------------------------
OWNER_NAME VARCHAR2(30)
FLASHBACK_ARCHIVE_NAME NOT NULL VARCHAR2(255)
FLASHBACK_ARCHIVE# NOT NULL NUMBER
RETENTION_IN_DAYS NOT NULL NUMBER
CREATE_TIME TIMESTAMP(9)
LAST_PURGE_TIME TIMESTAMP(9)
STATUS VARCHAR2(7)
SQL> select OWNER_NAME,FLASHBACK_ARCHIVE_NAME,RETENTION_IN_DAYS from dba_flashback_archive where owner_name='FR_ADMIN';
OWNER_NAME
------------------------------
FLASHBACK_ARCHIVE_NAME
--------------------------------------------------------------------------------
RETENTION_IN_DAYS
-----------------
FR_ADMIN
FRA1
365
SQL> sho user;
USER is "FR_ADMIN"
SQL> grant flashback archive on fra1 to sh;
Grant succeeded.
SQL> conn sh/sh
Connected.
SQL> alter table promotions flashback archive fra1;
SQL> conn / as sysdba;
Connected.
SQL> select * from dba_flashback_archive_tables;
TABLE_NAME OWNER_NAME
------------------------------ ------------------------------
FLASHBACK_ARCHIVE_NAME
--------------------------------------------------------------------------------
ARCHIVE_TABLE_NAME STATUS
----------------------------------------------------- -------------
PROMOTIONS SH
FRA1
SYS_FBA_HIST_88064 ENABLED
SQL> set autot trace exp
SQL> select * from sh.promotions versions between timestamp (systimestamp-interval '20' minute) and (systimestamp-interval '1' minute);
Execution Plan
----------------------------------------------------------
Plan hash value: 4106015420
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 503 | 49294 | 58 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| PROMOTIONS | 503 | 49294 | 58 (0)| 00:00:01 |
--------------------------------------------------------------------------------
SQL> ALTER TABLE sh.promotions NO FLASHBACK ARCHIVE;
Table altered.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13750068/viewspace-2144053/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Flashback Data Archive (Oracle Total Recall)HiveOracle
- Oracle Flashback Data ArchiveOracleHive
- 【FLASHBACK】Oracle flashback data archive 介紹OracleHive
- Flashback Data Archive RequirementsHiveUIREM
- Flashback Data Archive原理詳解Hive
- oracle 11g 新特性 Flashback Data Archive 說明OracleHive
- Oracle OCP IZ0-053 Q166(Flashback Data Archive)OracleHive
- Oracle OCP 1Z0-053 Q672(Flashback Data Archive)OracleHive
- 閃回資料歸檔-- Flashback Data ArchiveHive
- Playing with Flashback Data Archive on 11GR2Hive
- Oracle OCP 1Z0 053 Q143(Flashback Data Archive)OracleHive
- 11G Flashback Data Archive新特性的研究Hive
- Oracle 11g新特性--閃回資料歸檔(flashback data archive)[zt]OracleHive
- Oracle Flashback Archive——Oracle閃迴歸檔(上)OracleHive
- Oracle Flashback Archive——Oracle閃迴歸檔(中)OracleHive
- Oracle Flashback Archive——Oracle閃迴歸檔(下)OracleHive
- How To Replicate Data from Oracle to Postgres Using GoldenGate (Doc ID 1544137.1OracleGo
- oracle11g flashback archive feature新特性OracleHive
- 11G flashback data archive 導致產生大量歸檔日誌Hive
- How to enable the flashback database:Database
- How to migrate data from Oracle to MSSQLSERVEROracleSQLServer
- How Oracle Uses the Data Dictionary (262)Oracle
- How to check whether the current database in using Oracle optionsDatabaseOracle
- flashback drop/query/table/database/archiveDatabaseHive
- DBMS_FLASHBACK_ARCHIVE在Oracle版本中的支援情況HiveOracle
- How to get ORACLE_HOME from data dictionaryOracle
- 11g feature: Flashback Data Archive Guide. (Doc ID 470199.1)HiveGUIIDE
- 11G新特性:FLASHBACK ARCHIVEHive
- Oracle OCP 1Z0 053 Q138(DROP FLASHBACK ARCHIVE)OracleHive
- Step by Step Data Replication Using Oracle GoldenGateOracleGo
- How to Find Out How Much Space an Index is UsingIndex
- How to Set Device Name Using UDEV on Oracle Linux 7.1devOracleLinux
- 11G新特性:FLASHBACK ARCHIVE - 01Hive
- 11G新特性:FLASHBACK ARCHIVE – 02Hive
- oracle10g data guard(dg)__flashback_physical databaseOracleDatabase
- Oracle 12.2 How to Generate AWRs in Active Data Guard Standby DatabasesOracleDatabase
- flashback database 結合 data guardDatabase
- How boltdb Write its Data?