sqloraclebackuporacle10grman

Backup/Restore database for oracle 10g testing using sqlplus or rman


Using Oracle 10g with our testing server what is the most efficient/easy way to backup and restore a database to a static point, assuming that you always want to go back to the given point once a backup has been created.

A sample use case would be the following

  1. install and configure all software
  2. Modify data to the base testing point
  3. take a backup somehow (this is part of the question, how to do this)
  4. do testing
  5. return to step 3 state (restore back to backup point, this is the other half of the question)

Optimally this would be completed through sqlplus or rman or some other scriptable method.


Solution

  • You do not need to take a backup at your base time. Just enable flashback database, create a guaranteed restore point, run your tests and flashback to the previously created restore point.

    The steps for this would be:

    1. Startup the instance in mount mode.

      startup force mount;

    2. Create the restore point.

      create restore point before_test guarantee flashback database;

    3. Open the database.

      alter database open;

    4. Run your tests.

    5. Shutdown and mount the instance.

      shutdown immediate; startup mount;

    6. Flashback to the restore point.

      flashback database to restore point before_test;

    7. Open the database.

      alter database open;