Database backup and recovery basics

27
Database Backup and Recovery Basics Supervised By : Samir Hillis Done By :Shahed Abo Saleem

Transcript of Database backup and recovery basics

Database Backup and Recovery Basics

Supervised By : Samir HillisDone By :Shahed Abo Saleem

What the different between redo log file and archived log file

Redo log : recordrecord of all changes made to the database; used for recovery.

Archived log : copycopy of the contents of previous online redo loges; used for recovery.

• Goal of the database administrator• What is Backup and Recovery• Types of backup • Categories of Failure• Configuring for Recoverability• Different between no archive log mode

and archive log mode

OutlineOutline

• Goal of the database administrator• What is Backup and Recovery• Type backup • Categories of Failure• Configuring for Recoverability• Different between no archive log mode and

archive log mode

Goal of the database administrator

Is to ensure that the database is open open and available and available when users need it.

How to achieve goal ?

How to achieve goal ?• To achieve that goal, the DBA

• Protect the database from failure wherever possible.

• Increase the mean time between failures (MTBF).

• Protect by redundancy.• Decrease the mean time to recover (MTTR).• Minimize the loss of data.

• Goal of the database administrator• What is Backup and Recovery• Types of backup • Categories of Failure• Configuring for Recoverability• Different between no archive log mode and

archive log mode

What is Backup and Recovery?

• BackupBackup is a copy of data from your database that can be used to reconstruct that data.

• Recovery Recovery is carried out through archive records or known as Archive System .

• In generalIn general, backup and recovery refers to the various strategies and procedures involved in protectingprotecting your database against data loss and reconstructingreconstructing the database after any kind of data loss.

• Goal of the database administrator• What is Backup and Recovery• Types of backup • Categories of Failure• Configuring for Recoverability• Different between no archive log mode and

archive log mode

Backup

• A backup is a copy of data from your database that can be used to reconstruct that data.

• BackupsBackups can be divideddivided into physical backupsphysical backups and logical backupslogical backups.

Physical Backups

• Physical backups Physical backups are backups of the physical files physical files used in storing and recovering database, such as data files, control files, and archived redo logs.

• EveryEvery physical backup is a copycopy of files storing database information to some other location, whether on disk or some offline storage

Logical Backups• Logical backupsLogical backups contain logical data (for example,

tables or stored procedures) exported from a database with an Oracle export utility Oracle export utility and stored in a binary file, for later re-importing into a database using the corresponding Oracle import utility.Oracle import utility.

Physical Backups and Logical Backups

• Physical backups Physical backups are the foundationfoundation of any backup and recovery strategy.

• Logical backups Logical backups are a useful supplement useful supplement to physical backups in many circumstances but are not sufficient protection against data loss without physical backups.

• Goal of the database administrator• What is Backup and Recovery• Types of backup • Categories of Failure• Configuring for Recoverability• Different between no archive log mode and

archive log mode

Categories of Failure• While there are several types of problem that can halt the

normal operation of an Oracle database or affect database I/O operations, only two only two typically require DBA intervention and media recovery: media failure, and user errors.media failure, and user errors.

• Other failures may require DBA intervention to restart the database (after an instance failure) or allocate more disk space (after statement failure due to, for instance, a full data file) but these situations will not generally cause data loss or require recovery from backup.

Categories of Failure

• The Oracle database provides Oracle Flashback technology.

• Oracle Flashback technology:- a group of features that support • Viewing past states of data.• Winding data back and forth in time.• Without requiring restoring the database from backup.

• With this technology, you help users analyze and recover from errors.

User error

• For users who have committed erroneous changes, use the following to analyze the errors:-

• Oracle Flashback Query (SELECT … AS OF…)• Oracle Flashback Versions Query (SELECT …

VERSIONS BETWEEN…)• Oracle Flashback Transaction Query• Possible solutions to recover from user error:• Oracle Flashback Transaction Backout • Oracle Flashback Table • Oracle Flashback Drop

User error

User errorTypical Causes Possible Solutions

User inadvertently deletes or modifies data.

Roll back transaction and dependent transactions or rewind table.

User drops a table. Recover table from recycle bin.

Oracle LogMiner

Media Failure

Typical Causes Possible Solutions

Failure of disk drive 1. Restore the affected file from backup.2. Inform the database about a new file

location (if necessary).3. Recover the file by applying redo

information (if necessary).Failure of disk controller

Deletion or corruption of database file

• Goal of the database administrator• What is Backup and Recovery• Type backup • Categories of Failure• Configuring for Recoverability• Different between no archive log mode and

archive log mode

Configuring for Recoverability

• To provide the best protection for your data, you must work some step including :- Archive Log Files

• Goal of the database administrator• What is Backup and Recovery• Type backup • Categories of Failure• Configuring for Recoverability• Different between no archive log mode and

archive log mode

Different between no archive log mode and archive log mode

NOARCHIVELOG mode• is basically the absence of

ARCHIVELOG mode and has the disadvantage of not being able to recover to any point in time.

• NOARCHIVELOG mode does have the advantage of not having to write transactions to an archive log and thus increases the performance of the database slightly.

ARCHIVELOG mode • a mode that you can put the

database in for creating a backup of all transactions that have occurred in the database so that you can recover to any point in time.

ARCHIVELOG MODE• Advantages :-

1. You can perform hot backups (backups when the database is online).2. The archive logs and the last full backup (offline or online) or an older backup can completely recover the database without losing any data because all changes made in the database are stored in the log file.

• Disadvantages1. It requires additional disk space to store archived log files. However, the agent offers the option to purge the logs after they have been backed up, giving you the opportunity to free disk space if you need it.

NO-ARCHIVELOG MODE• Advantages

1. It requires no additional disk space to store archived log files.

• Disadvantages1. If you must recover a database, you can only restore the last full offline

backup. As a result, any changes made to the database after the last full offline backup are lost.

2. Database downtime is significant because you cannot back up the database online. This limitation becomes a very serious consideration for large databases.

What is MTTR and MTBF

• Mean Time To Recover (MTTR) Mean Time To Recover (MTTR) is the average time that a device will take a device will take to recover from a without failure.

• Mean Time Between Failures (MTBF) Mean Time Between Failures (MTBF) is the average time that a component works component works without failure.