CERN/IT/DB
AGENDA
Why plan backups? Overview of backups
CERN/IT/DB
CERN/IT/DB
CERN/IT/DB
CERN/IT/DB
CERN/IT/DB
Overview of backups
Physical backups
protect against global failure Cold backups : database needs to be stopped Hot backups : database keeps on running
CERN/IT/DB
Definition
All changes are kept in archived logs The more activity, the more archived logs Central db: 600 logs per week (30M each=18G transactions volume per week)
CERN/IT/DB
BACKUP
CERN/IT/DB
CERN/IT/DB
CERN/IT/DB
CERN/IT/DB
Database must be down Loss of data between backup and failure if not using ARCHIVELOG mode Corruption may not be recognized! Might not backup everything: Backup scripts must be often checked and tested!
CERN/IT/DB
CERN/IT/DB
CERN/IT/DB
CERN/IT/DB
CERN/IT/DB
Backups implementation
(1/3)
Most production databases run in ARCHIVELOG mode Archived redo logs stored on two different tape devices Home-grown scripts perform
depending on the service:
daily/weekly cold/hot backup + daily full export
CERN/IT/DB
Backups implementation
(2/3)
On mission-critical systems :
Shutdown the oracle database Detach the mirrors Restart the database on one side => service
CERN/IT/DB
Backups implementation
(3/3)
On the central database cluster.. The 2 nodes synchronize a clean rundown of the common database
Node A detaches the database mirrors and restarts DB Tells node B to restart as well Performs a cold backup onto disks Reattaches the mirrors
CERN/IT/DB
Oracle EXPORT/IMPORT
The Export and Import Oracle utilities generate a file with a logical copy of the data and application Export and Import are useful to recover specific items lost due to user errors Export and Import help migration to different releases of the Oracle RDBMS
CERN/IT/DB
EXPORT/IMPORT(contd)
Export and Import support object types Export writes object type definitions and all associated data to the dump file Import then re-creates these items from the dump file The definition statements for derived types are exported, same applies to OIDs
CERN/IT/DB
EXPORT (logical)
Database must be up and running Export reads the database using SQL
Export file contains create and insert statements
CERN/IT/DB
Benefits of export
Easy to recover individual items Portable:
can be used to move data from one machine to another useful in a heterogeneous environment
Unlike backup, export identifies physical data block corruption since it performs a full table scan while exporting a table
CERN/IT/DB
Drawbacks of export
Does not provide point in time recovery
CERN/IT/DB
Export/import examples
Export of a full database (from a DBA): EXP FULL=Y FILE=fullexp.dmp LOG=fullexp.log
Export of a specific schema: EXP USER/PASSWORD TABLES=(RUN1,RUN2) FILE=runs12.dmp LOG=runs12.log
CERN/IT/DB
Recovery considerations
Media recovery:
Done in response to a RECOVERY command Has to be done by a DBA after identifying the appropriate recovery action depending on the failure (datafile, tablespace, database)
CERN/IT/DB
NOARCHIVELOG mode
Only offline backup (or export) can be used What to do:
Restore all copies of datafiles, control files and redo log files startup the database
Recovery in
You are back in the status when the backup (export) were run
CERN/IT/DB
CERN/IT/DB
Benefits of recovery
Database recovery can be complete or not:
recover database (complete) recover database until time 2001-0710:10:05:00 recover database until cancel recovery of TABLESPACE or DATAFILE can only be complete
CERN/IT/DB
Implications of recovery
Database is not open to the users It can take a long time depending on the number of redo log files to be applied. Must have ALL required files (datafiles, archived redo log files).
CERN/IT/DB
SUMMARY
5 real cases of Oracle recovery have been performed in the past 7 years (Successful) Many items have been recovered from export files to repair accidental deletion of items WHO WANTS TO TEST NEXT?