Thursday, August 30, 2007

Working with database backups in Oracle 10g

Working with database backups in Oracle 10g

Learning objective

After completing this topic, you should be able to recognize how to configure and manage database backups.

1. Image copies and backup sets

A whole-database backup includes all datafiles and at least one control file - remember that all control files within a database are identical.

Partial database backups may include zero or more tablespaces and zero or more datafiles. They may or may not include a control file.

There are two types of backups you can use:

  • full backups
  • incremental backups
full backups
Full backups make a copy of every datablock that contains data within the files being backed up.
incremental backups
Incremental backups make a copy of all datablocks that have changed since a previous backup.

Oracle Database 10 g supports two levels of incremental backup . A level 0 or baseline backup is equivalent to a full backup and contains all datablocks. A level 1 incremental backs up all database blocks changed since the level 0 backup. To restore using incremental backups, the baseline backup must be restored first, then the incremental.

Incremental backups provide shorter recovery time, save backup storage, and use less bandwidth when backing up over a network.

Offline backups - also known as consistent backups - are taken while the database is not open. They are consistent because at the time of the backup, the SCN datafile headers match the SCN in the control files.

Online backups - also known as inconsistent backups - are taken while the database is open. These backups are inconsistent because, with the database open, there is no guarantee that the datafiles are synchronized with the control files. Inconsistent backups require recovery in order to be used.

There are two formats for storing backups of your files:

  • image copies
  • backup sets
image copies
An image copy contains a duplicate of a single datafile, archived redo log file, or control file that you can use to perform recovery. Only the individual file needs to be restored.

Image copies back up every single datablock, including empty datablocks.

Image copies must be backed up to disk. The advantage of creating a backup as an image copy is improved granularity of the restore operation.


backup sets
Backup sets contain logically grouped duplicates of datafiles, archived redo log files, or control files. The entire backup set needs to be retrieved from tape before you extract the file or files that are needed.

The advantage of backup sets is that they use less space. Backup sets don't store empty datablocks and employ unused-block compression to save space.

Backup sets can be backed up to disk or directly to tape. In most systems, backup sets are more efficient than image copies.

Databases in NOARCHIVELOG mode must perform offline, full, whole-database backups.

Databases in ARCHIVELOG mode have access to the full range of backup options.

Question

Match each backup method to its description.

Options:

  1. Image copies
  2. Backup sets

Targets:

  1. This backup method backs up every single datablock, including empty datablocks.
  2. This backup method saves space by not storing empty datablocks and by employing unused-block compression.

Answer

Image copies back up every single datablock, including empty datablocks. Backup sets save space by not storing empty datablocks and by employing unused-block compression.

Image copies must be backed up to disk.

Backup sets can be backed up to disk or directly to tape.

2. Recovery Manager

Recovery Manager (RMAN) is an Oracle Database utility for managing backup, restore, and recovery operations.

Advanced backup and recovery operations are accessible through RMAN's command-line client. Enterprise Manager provides a graphical user interface for RMAN, making it easy to manage these recovery operations.

You can use RMAN to back up datafiles, archived log files, and files in the Flash Recovery Area.

RMAN can perform

  • whole or partial backups
  • full or incremental backups
  • online and offline backups

RMAN can store backups on disk for quick recovery, or place them on tape for long-term storage.

To store backups on tape using RMAN, you must configure an interface to the tape device, known as a media management layer (MML).

RMAN uses its own powerful job control and scripting language, as well as a published API that interfaces RMAN with many popular backup software solutions.

Question

Identify the capabilities of RMAN.

Options:

  1. Backs up datafiles
  2. Backs up archived log files
  3. Backs up files to disk or tape
  4. Configures the Flash Recovery Area

Answer

RMAN can back up datafiles and archived log files to disk or tape.

Option 1 is correct. Enterprise Manager provides a graphical user interface for RMAN, making it easy to manage datafile recovery operations.

Option 2 is correct. RMAN can be used to perform whole or partial backups, full or incremental backups, and online or offline backups.

Option 3 is correct. RMAN can store backups on disk for quick recovery, or place them on tape for long-term storage.

Option 4 is incorrect. RMAN can only back up the files in the Flash Recovery Area, not configure the area.

3. Configuring backup settings

You can use Enterprise Manager to configure your backup settings.

To do this you need to navigate to the Configure Backup Settings page.

You click Maintenance. Then click Configure Backup Settings.

The Configure Backup Settings page allows you to manage the settings that will be used when you create backups. Disk settings include

  • Parallelism
  • Disk Backup Location
  • Disk Backup Type
Parallelism
The value you enter in the Parallelism field dictates the number of separate streams of backup information that will be created.

Proper use of parallelism can greatly increase performance on backup and recovery tasks. However, a single CPU, single-disk controller, or single-disk server would not benefit from conducting parallel backups.
Disk Backup Location
The Disk Backup Location field allows you to specify where your files are stored. If you don't enter a path in this field, the files are stored in the Flash Recovery Area by default. If you change this value, you can click Test Disk Backup to verify that RMAN can access the specified location.
Disk Backup Type
The Disk Backup Type setting gives you a choice of image copies, backup sets, or compressed backup sets for backing up your files.

You only want to create one stream of backup information, so you enter 1 in the Parallelism field.

You leave the Disk Backup Location field blank, because you want to store your files in the default location - the Flash Recovery Area.

You want to employ unused-block compression to save space, so you ensure that Backup Set is selected in the Disk Backup Type section.

You can also configure tape backup settings on this page. The tape settings you enter depend on the media management layer's capabilities.

If you intend to save any changes to the backup settings, you need to supply your login information in the Host Credentials section.

In this case, Enterprise Manager remembers your preferred credentials.

Next, you click the Backup Set tab.

On this page, you can set the maximum size of backup set pieces. You want to set the file size to 8 MB and then access the Policy tabbed page.

You enter 8 in the Maximum Backup Piece (File) Size field and click the Policy tab.

On the Policy tabbed page, you can automatically back up the control file and SPFILE with each backup.

You can also optimize backups by ignoring offline or read-only datafiles.

In addition, the Policy page gives you the option of enabling block change tracking and specifying a location for the tracking file.

If you intend to create incremental backups, this setting can decrease the time taken to locate changed blocks to include in the incremental backup.

You scroll down to the Retention Policy section of the page. Your retention policy dictates how long RMAN keeps your backups, and how many copies to keep.

You select Retain All Backups and click OK.

You have successfully configured your backup settings. You are returned to the Maintenance tabbed page.

Question

Which of these settings can you configure for backups from the Configure Backup Settings page?

Options:

  1. Disk backup location
  2. Disk backup type
  3. Flash Recovery Area location
  4. Parallelism

Answer

You can configure parallelism, disk backup location, and disk backup type from the Configure Backup Settings page.

Option 1 is correct. You can specify manually the disk backup location where your files are stored.

Option 2 is correct. You can back up your files as image copies, backup sets, or compressed backup sets.

Option 3 is incorrect. To specify the location of the Flash Recovery Area, you use the Configure Recovery Settings page.

Option 4 is correct. The parallelism setting determines how many streams of backup information will be created.

Question

Suppose you are configuring the backup settings for your database. You need to back up every single datablock, including empty datablocks. You only want to create one stream of backup information, and you decide to store your files in the Flash Recovery Area.

Which sequence of steps would you use to complete this task?

Options:

  1. Enter 1 in the Parallelism field and select Image Copy. Then click OK.
  2. Enter 1 in the Parallelism field and select Backup Sets. Then click OK.

Answer

You enter 1 in the Parallelism field and select Image Copy. Then you click OK.

4. Managing database backups

Now that you have configured your backup settings, you need to manage your existing backups.

To do this, you click Manage Current Backups.

The Manage Current Backups page allows you to see when a backup was completed, where it was created, and whether it is still available.

Backups are marked Available if they are still present in the location listed in the RMAN repository. Backups that are missing or corrupt are marked Expired.

At the top of the Manage Current Backups page, there are four buttons that allow you to perform operations on your existing backups:

  • Catalog Additional Files
  • Crosscheck All
  • Delete All Obsolete
  • Delete All Expired
Catalog Additional Files
If there are backups that are not currently being managed by RMAN, you can use the Catalog Additional Files button to add them to the catalog.
Crosscheck All
Clicking the Crosscheck All button allows RMAN to compare the actual file with the record of the backup in the catalog.

If you delete a backup without using RMAN, you can perform a crosscheck to update the catalog.
Delete All Obsolete
The Delete All Obsolete button deletes backups that are older than the duration set in the retention policy.
Delete All Expired
The Delete All Expired button deletes references in the catalog to any backups that are found to be missing or inaccessible during a crosscheck operation.

In this case you want to add backups to the catalog.

You click Catalog Additional Files.

On the Catalog Additional Files page, you can either catalog all files in the recovery area or specify another location. If the files are in another location, you must enter a path in the Starts With field.

In this case, the backups you want to add are located in the recovery area, so you accept the default and click OK.

Enterprise Manager displays a message confirming that the files you specified have been cataloged in the Recovery Manager repository.

Next, you want to crosscheck all files in the RMAN repository.

You click Crosscheck All.

On the Crosscheck All: Specify Job Parameters page, you can schedule regular crosschecks or run one immediately.

You want the crosscheck to occur immediately, so you accept the default settings and click Submit Job.

Enterprise Manager displays a message verifying that the job has been submitted.

If you want to delete backups that no longer meet your retention policy, you click Delete All Obsolete.

On the Delete All Obsolete: Specify Job Parameters page, you can run the deletion job immediately or schedule it to run later.

If you want to delete backups that RMAN found to be inaccessible during a crosscheck, you click Delete All Expired.

On the Delete All Expired: Specify Job Parameters page you can specify a job execution schedule. You can also specify that another crosscheck should be run before deleting the catalog listings.

If you choose to perform another crosscheck, RMAN will have the most up-to-date information about expired backups.

Question

Which of these management tasks can you perform from the Manage Current Backups page?

Options:

  1. Catalog additional files
  2. Crosscheck backups
  3. Delete expired backups
  4. Enable parallelism

Answer

You can catalog additional files, crosscheck backups, and delete expired backups.

Option 1 is correct. If you have backups that are not currently being managed by RMAN, you can use the Catalog Additional Files function to add them to the catalog.

Option 2 is correct. Crosschecking backups allows RMAN to compare the actual file with the record of the backup in the catalog.

Option 3 is correct. You can delete references in the catalog to any backups that are found to be missing or inaccessible during a crosscheck operation.

Option 4 is incorrect. You can enable parallelism from the Configure Backup Settings page.

Question

Suppose you are managing your existing backups. There are a number of backup files in the Flash Recovery Area that you need to add to the catalog.

Which sequence of steps would you use to complete this task?

Options:

  1. Click Catalog Additional Files. Then click OK.
  2. Click Catalog Additional Files. Then select Catalog Files in the specified disk location into the Recovery Manager repository and click OK.

Answer

You click Catalog Additional Files. Then you click OK.

5. Configuring the Flash Recovery Area

The Flash Recovery Area is a location set aside on your disk to store archived logs, backups, and flashback logs. It makes it easy to manage files related to backup and recovery.

To configure parameters for the Flash Recovery Area, you open the Maintenance tabbed page and select Configure Recovery Settings.

The Configure Recovery Settings page appears.

From this page you can carry out several Flash Recovery Area settings and checks, including

  • specifying its location and size
  • verifying how much of it has been used

Because you created the Flash Recovery Area when you created the database, the Flash Recovery Area Location field is filled by default.

The Flash Recovery Area Size field was also set when the database was created. If you want to change the size allocated to this area, you can alter the value in this field.

It is important to monitor the size of the Flash Recovery Area to ensure it doesn't become full. The suggested size is at least twice the size of the database.

You enter 8 in the Flash Recovery Area Size field.

If flashback logging is enabled, you have the option of returning the whole database to a previous state without the need to restore files.

Now you need to implement your changes.

You click Apply.

Enterprise Manager displays a message confirming that the changes have been made successfully.

Question

What can you do in the Flash Recovery Area section of the Configure Recovery Settings page?

Options:

  1. Specify that the Flash Recovery Area is used as the destination for archive logs
  2. Specify the location of the Flash Recovery Area
  3. Specify the size of the Flash Recovery Area
  4. Verify how much of the Flash Recovery Area is used

Answer

In the Flash Recovery Area section of the Configure Recovery Settings page, you can configure the size and location of the Flash Recovery Area and verify how much of it is used.

Option 1 is incorrect. This function is configured in the Media Recovery section of this page.

Option 2 is correct. Because the Flash Recovery Area is created automatically when the database is created, the Flash Recovery Area Location field is filled by default, but you can configure a different location.

Option 3 is correct. The suggested size for the Flash Recovery Area is at least twice the size of the database.

Option 4 is correct. It is important to monitor the size of this area to ensure it doesn't become full.

Question

Suppose your Flash Recovery Area is nearly full and you need to make it larger. You want to change the size of the Flash Recovery Area to 8 GB.

Which sequence of steps would you use to complete this task?

Options:

  1. Select Configure Recovery Settings. Enter 8 in the Flash Recovery Area Size field and click Apply.
  2. Select Configure Recovery Settings. Enter 8 in the Flashback Retention Time field and click Apply.

Answer

You select Configure Recovery Settings. Then you enter 8 in the Flash Recovery Area Size field and click Apply.

Summary

Oracle Database 10 g backups can be whole or partial, full or incremental, and online or offline. Its two backup formats are image copies and backup sets.

Recovery Manager (RMAN) is a utility for managing backup, restore, and recovery operations. Enterprise Manager provides a graphical user interface for RMAN.

You can use RMAN for settings such as enabling parallelism, choosing a disk location and backup type, and specifying a backup retention time.

Enterprise Manager also makes it easy to manage your backups. It allows you to catalog additional backups, crosscheck backups, and delete expired and obsolete backups.

You can also configure and check Flash Recovery Area's location and size, and enable flashback logging.

No comments: