Powered By Blogger

Wednesday, July 13, 2011

Flashback Data Archive in 11g

SQL> CREATE TABLESPACE FDB DATAFILE 'D:\APP\NAV6COB\ORADATA\ORCL11G\FDB_DATA_1.DBF' SIZE 10m;

Tablespace created.

SQL> CREATE FLASHBACK ARCHIVE DEFAULT FDA_1 TABLESPACE fdb quota unlimited retention 1 year;
CREATE FLASHBACK ARCHIVE DEFAULT FDA_1 TABLESPACE fdb quota unlimited retention 1 year
                                                            *
ERROR at line 1:
ORA-55603: Invalid Flashback Archive command


SQL> CREATE FLASHBACK ARCHIVE DEFAULT FDA_1 TABLESPACE fdb retention 1 year;

Flashback archive created.

SQL>
SQL> select * from dba_flashback_archive;

OWNER_NAME FLASHBACK_ARCHIVE_NAME FLASHBACK_ARCHIVE# RETENTION_IN_DAYS CREATE_TIME LAST_PURGE_TIME STATUS
------------------------------ -------------------------------------------------------------------------------------------------------------------------------------------
SYS        FDA_1                    1               365 13-JUL-11 12.27.06.000000000 PM 13-JUL-11 12.27.06.000000000 PM            DEFAULT
SQL>
SQL> select * from dba_flashback_archive_tables;

TABLE_NAME OWNER_NAME FLASHBACK_ARCHIVE_NAME ARCHIVE_TABLE_NAME STATUS
------------------------------------------------------------    
EMP1     SCOTT             FDA_1  SYS_FBA_HIST_73694   ENABLED

SQL> alter table emp1 flashback archive;

Table altered.

SQL>
SQL>
SQL> update emp1 set ename='NAVANEETH' where empno=7369;

1 row updated.

SQL> commit;

Commit complete.

SQL> drop table emp1;
drop table emp1
           *
ERROR at line 1:
ORA-55610: Invalid DDL statement on history-tracked table

Managing Flashback archive:


SQL> ALTER FLASHBACK ARCHIVE fda_1 MODIFY RETENTION 2 YEAR;

Flashback archive altered.

SQL> alter flashback archive fda_1 purge all;

Flashback archive altered.

SQL> drop flashback archive fda_1;

Flashback archive dropped.

SQL>

No comments:

Post a Comment