Thursday, March 27, 2008

Tip # 1: flashback query 9i+

Tip: Two powerful tools make queries on past data available now (9i+)
If you recently upgraded to 9i or 10g, you have powerful new tools for taking snapshots of data from the past.

The UNDO tablespace and its associated UNDO_RETENTION setting give you and your users:
* The ability to run reports from a certain point in time.
* The ability to use a SQL script to re-create accidentally changed or deleted data.


The syntax for performing a flashback query is AS OF. You use this clause together with a data mask,
as in SELECT deptno, sum(Sal) FROM emp GROUP BY deptno AS OF TO_DATE('13-Jul-05' 09:00, date HH:MM);.

To enable this feature:
* Set the parameter UNDO_MANAGEMENT=AUTO.
* Set the UNDO_RETENTION parameter to tell Oracle how many days back you need it to store old data.
* Create an UNDO tablespace with ample room to store the past data.
* Grant the FLASHBACK privilege on specific tables, or FLASHBACK ANY TABLE privilege to users and roles who need to use this feature.

1 comment:

Unknown said...

Nice site for ORACLE, Good Information provided my Mate on OBIEE Online Training