Oracle
  Home arrow Oracle arrow Page 3 - Implementing and Using Oracle`s Restore Point Functionality
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ORACLE

Implementing and Using Oracle`s Restore Point Functionality
By: Ray Terrill
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 4
    2008-07-22


    Table of Contents:
  • Implementing and Using Oracle`s Restore Point Functionality
  • Example 1: Normal Restore Point - Flashback Logging Disabled
  • Example 2: Guaranteed Restore Point - Flashback Logging Enabled
  • Reset and Reopen

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Implementing and Using Oracle`s Restore Point Functionality - Example 2: Guaranteed Restore Point - Flashback Logging Enabled
    ( Page 3 of 4 )

    To illustrate the use of a guaranteed restore point, we'll use an example where we have a new batch process we're testing that will be moving to production in the near future, and would like to test multiple algorithms to determine the most efficient method for processing the data. We'll create a restore point before running the tests, enabling us to in effect "reset" the database back to the exact same point in time before each test.

    This will make our testing much easier, ensuring that we're doing an apples-to-apples comparison of the algorithms while minimizing both the amount of work the DBA must do to restore the old data as well as the amount of time spent to do this restore.

    Because we'd like to have the ability to utilize the full spectrum of functionality provided by restore points and flashback database, we'll enable flashback database now. Ensure the prerequisites have been met (both Restore Point Prerequisites and Flashback Database Prerequisites above), and use the following steps to enable flashback logging on your database:


    oracle@dbatest:~> sqlplus / as sysdba


    SQL*Plus: Release 10.2.0.2.0 - Production on Tue May 27 10:18:42 2008


    Copyright (c) 1982, 2005, Oracle. All Rights Reserved.



    Connected to:

    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production

    With the Partitioning, OLAP and Data Mining options


    SQL> shutdown immediate;

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    SQL> startup mount;

    ORACLE instance started.


    Total System Global Area 159383552 bytes

    Fixed Size 1259696 bytes

    Variable Size 62916432 bytes

    Database Buffers 92274688 bytes

    Redo Buffers 2932736 bytes

    Database mounted.

    SQL> alter database flashback on;


    Database altered.


    SQL> alter database open;


    Database altered.


    After we've enabled flashback database, we'll create a second test procedure to "process" our data for this example. As in example 1, our procedure will make some basic manipulations on our data, which will represent a more complex business process. This time, however, our procedure will affect more than one table, allowing us to illustrate the effect of the more global flashback database (vs. the flashback table from example 1).


    SQL> create or replace procedure testuser.process_data is

    2 begin

    3 insert into testuser.logging values (sysdate, 'Begin procedure');

    4 delete from testuser.test where id > 50;

    5 insert into testuser.logging values (sysdate, 'End procedure');

    6 commit;

    7 end;

    8 /


    Procedure created.


    With our batch processing procedure compiled, we're ready to create a guaranteed restore point to "label" the current starting point for use later in flashing back the database:


    SQL> create restore point before_test guarantee flashback database;


    Restore point created.


    As we've now tagged our current point in time, we'll execute the batch processing procedure, and verify that we have only 50 rows remaining in the testuser.test table, and that we've generated some logging in our testuser.logging table:


    SQL> exec testuser.process_data(5);


    PL/SQL procedure successfully completed.


    SQL> select count(*) from testuser.test;


    COUNT(*)

    ----------

    50


    SQL> select * from testuser.logging;


    TIMESTAMP LOGINFO

    --------- ---------------

    27-MAY-08 Begin procedure

    27-MAY-08 End procedure



     
     
    >>> More Oracle Articles          >>> More By Ray Terrill
     

       

    ORACLE ARTICLES

    - Oracle's Turn to Play in the Sun
    - Implementing and Using Oracle`s Restore Poin...
    - Tuning PL/SQL Code
    - Debugging PL/SQL Code
    - Testing PL/SQL Code
    - Working With PL/SQL Code
    - Conditional Compilation for Oracle Database ...
    - Compile-Time Warnings for Oracle DB 10g
    - Compiling PL/SQL Code for an Oracle Database
    - Troubleshooting PL/SQL Code
    - Managing PL/SQL Code
    - Data Manipulation and More for HTML DB Appli...
    - Oracle Database Fundamentals
    - Adding Processes to HTML DB Applications
    - Adding Computations, Processes, and Validati...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT