Sunday, November 28, 2010

Use of FLASHBACK in expdp in oracle


You can export backup of database which was like certain months ago. This you can do using the FLASHBACK_TIME or FLASHBACK_SCN option

Here are more details on it.

FLASHBACK_TIME

Default: none

Purpose

The SCN that most closely matches the specified time is found, and this SCN is used to enable the Flashback utility. The export operation is performed with data that is consistent as of this SCN.

Syntax and Description

FLASHBACK_TIME="TO_TIMESTAMP(time-value)"  

Because the TO_TIMESTAMP value is enclosed in quotation marks, it would be best to put this parameter in a parameter file. Otherwise, you might need to use escape characters on the command line in front of the quotation marks. See Use of Quotation Marks On the Data Pump Command Line.

Restrictions

FLASHBACK_TIME and FLASHBACK_SCN are mutually exclusive.

The FLASHBACK_TIME parameter pertains only to the flashback query capability of Oracle Database 10g release 1. It is not applicable to Flashback Database, Flashback Drop, or any other flashback capabilities new as of Oracle Database 10g release 1.

Example

You can specify the time in any format that the DBMS_FLASHBACK.ENABLE_AT_TIME procedure accepts. For example, suppose you have a parameter file, flashback.par, with the following contents:

DIRECTORY=dpump_dir1 DUMPFILE=hr_time.dmp FLASHBACK_TIME="TO_TIMESTAMP('25-08-2003 14:35:00', 'DD-MM-YYYY HH24:MI:SS')"  

You could then issue the following command:

> expdp hr/hr PARFILE=flashback.par  

The export operation will be performed with data that is consistent with the SCN that most closely matches the specified time.