11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>11</strong>8 CHAPTER 3 ■ DATABASE ADMINISTRATIONSQL> alter flashback archive flash1purge all;# purges all archived dataSQL> alter flashback archive flash1purge beforetimestamp (systimestamp – interval '2' day);# purges data older than 2 daysSQL> alter flashback archive flash1purge before scn 123456;# purges all data before thespecified scnIt’s important to remember that the database will automatically purge the archived data aday after the retention period expires.Enabling and Disabling Flashback Data ArchivingOnce you create a flashback area, you must enable flashback logging for those tables whosetransactional changes you want to archive. You can’t turn flashback archiving on at the databaseor tablespace level. You must explicitly turn flashback archiving on for each table whosechanges you want to track. To enable flashback data archive logging, you must have theflashback archive object privilege on the flashback archive you want to use as well as the createtablespace system privilege. Of course, the DBA role automatically contains these privileges.By default, flashback logging is turned off for every table in the database. After you createone or more flashback data archives in your database, any table you create with the flashbackdata archive clause or any table you alter with the flashback data archive clause will haveflashback logging enabled automatically.To enable flashback logging for a table from its inception, modify your create table statementto include the flashback archive clause, as shown here:SQL> create table test<strong>11</strong> (2 name varchar2(30),3 address varchar2(50))4*flashback archive fla4;Table created.SQL>If you’ve designated a certain flashback data archive as the default flashback data archivefor the database, you can omit the name of the flashback data archive (fla4 in this example)and instead simply use the clause flashback archive. If you don’t specify a flashback dataarchive by name, the database will use the default flashback data archive for all create tableand alter table statements that specify a flashback archive clause.One of the wonderful features of the flashback data archive capability is that you can enablearchiving for already existing tables. This saves you the bother of having to re-create existingtables in order to take advantage of the flashback data archive feature. Use the flashback archiveclause to enable flashback archiving for an existing table, as shown here:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!