Thursday, August 30, 2007

Configuring database backups in Oracle 10g

Configuring database backups in Oracle 10g

Learning objective

After completing this topic, you should be able to configure database backups.

Exercise overview

In this exercise, you're required to configure database backups in Oracle Database 10 g.

This involves the following tasks:

  • configuring backup settings
  • specifying backup options
  • scheduling a backup

Your database is ready to move from test and development into production, and you want to ensure that it is configured so that recovery is possible without loss of data.

Task 1: Configuring backup settings

Configure the backup settings for your database. Change your disk backup location to "/u01/app/oracle/backup/". Make sure you create only one stream of backup information, and use a disk backup type that employs unused-block compression to save space. Set the maximum size of each backup piece to 8 MB.

Steps list
Instructions
1. Click Configure Backup Settings
2. Enter /u01/app/oracle/backup/ in the Disk Backup Location field
3. Ensure Backup Set is selected in the Disk Backup Type section and click the Backup Set tab
4. Enter 8 in the Maximum Backup Piece (File) Size field
5. Click OK

Task 2: Specifying backup options

Specify customized backup options so the entire database will be backed up while it is open for user activity. Configure your settings so that you can use this backup as a basis for incremental backups in the future. When you reach the Schedule Backup: Settings page, the task is complete.

Steps list
Instructions
1. Click the down-pointing arrow and select Customized
2. Ensure Whole Database is selected and click Next
3. Ensure Full Backup is selected and select Use as the base of an incremental backup strategy
4. Ensure that Online Backup is selected and click Next

Task 3: Scheduling a backup

When you've finished configuring your backup settings and destination, you need to specify when the backup should take place.

Schedule full backups for your database at 7:00 p.m. once a month, starting from today. Name the job "MONTHLY_BACKUP". When you reach the Schedule Backup: Review page, the task is complete.

Steps list
Instructions
1. Enter MONTHLY_BACKUP in the Job Name field
2. Select Later
3. Click the Hours down-pointing arrow in the Time section and select 7
4. Select PM
5. Select Monthly
6. Click Next

The Schedule Backup: Review page allows you to review your settings. When you are happy with your configuration, you proceed with the backup process by clicking Submit Job.

Scheduling database backups in Oracle 10g

Scheduling database backups in Oracle 10g

Learning objective

After completing this topic, you should be able to recognize how to schedule database backups and back up control files to trace.

1. Scheduling backup strategy

You should back up your database files regularly to avoid losing information. It can be useful to automate backups by configuring them to occur at regular intervals. Enterprise Manager provides a simple way of scheduling backups.

You start by clicking the Maintenance tab.

Then you click Schedule Backup.

This brings you to the Schedule Backup: Strategy page. Here, you can choose either the default Oracle backup strategy or your own custom strategy.

The Oracle-suggested backup strategy makes a one-time whole-database, baseline incremental level 0, online backup. It then schedules incremental level 1 backups for each following day.

By opting for a custom backup strategy, you gain access to a wider range of configuration options.

You decide to schedule a backup using your own settings.

You click the down-pointing arrow and select Customized.

Now you need to specify which objects you want to back up.

You can either back up the whole database, or choose individual objects, such as tablespaces, datafiles, archivelogs, or all recovery files currently residing on disk.

You want to back up all of your files, so you accept the default - Whole Database.

In order to specify backup settings, you need to supply your host credentials.

The username and password for your server are saved as the preferred credentials, so you click Next.

On the Schedule Backup: Options page, you can choose full or incremental level backups.

If you are performing a full backup, selecting Use as the base of an incremental backup strategy will make the backup an incremental level 0.

Alternatively, if you are performing an incremental level 1 backup with image copies, you can select Refresh the latest datafile copy on disk to the current time using the incremental backup - this updates the existing backup instead of creating a new image copy.

You accept the default - Full Backup.

You may want to use incremental backups at a later date.

You select the Use as the base of an incremental backup strategy checkbox.

Next, you scroll down to select the backup mode. Online backups can be performed while the database is open. An offline backup requires that the database be shut down and mounted before a backup.

If your database is in ARCHIVELOG mode, you can perform online backups. However, a database in NOARCHIVELOG mode must use offline backups.

You don't want the database to be shut down before a backup, so you accept the default - Online Backup.

In the Advanced section, you can choose to back up archived log files and delete them from disk once they are successfully backed up.

In this example, you don't want to back up archived log files, so you clear the Back up all archived logs on disk checkbox.

You click Delete obsolete backups to remove any backups that fall outside the retention policy you configured earlier.

RMAN will automatically remove obsolete backups if you are backing up to the Flash Recovery Area.

Next you can specify the maximum number of files you want to place in each backup set.

Limiting the number of files per set may speed the restore process. This is because the size of the backup set that must be returned from tape will be smaller than if a single backup set containing all the datafiles for the database were created.

You enter 4 in the Maximum Files per Backup Set field and then click Next.

The Schedule Backup: Settings page displays.

Question

Suppose you want to back up all of your database files. You want the backup to form the basis of future incremental backups and decide to choose your own settings.

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

Options:

  1. Click the down-pointing arrow and select Customized. Then click Next, select Full Backup and click the Use as the base of an incremental backup strategy checkbox. Finally, click Next.
  2. Click the down-pointing arrow and select Customized. Then click Next and select Incremental Backup (Level 1).

Answer

You click the down-pointing arrow and select Customized. Then click Next, select Full Backup and click the Use as the base of an incremental backup strategy checkbox. Finally, click Next.

2. Scheduling backup settings

The Schedule Backup: Settings page allows you to select a backup destination. You want your files to be backed up to disk, so you accept the default - Disk.

You can override many of the persistent configuration settings you created earlier by clicking Override Current Settings.

You are happy with the current settings, so you click Next.

The Schedule Backup: Schedule page enables you to specify how often a backup will occur.

You accept the default job name and description.

By default, the backup will take place immediately.

You don't want the backup to occur now, so you select Later.

Suppose you want to configure the backup to take place once a week.

You select Interval and enter 7 in the Frequency field. Finally, you click the down-pointing arrow and select Days.

Once you have specified that the backup will take place at the same time every week, you click Next.

The Schedule Backup: Review page displays.

Question

Suppose you want to automate your database backups. Rather than schedule the backup to occur immediately, you want to specify that it take place every 2 weeks at 2 AM, starting from today.

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

Options:

  1. Select Later, then select Interval and enter 2 in the Frequency field. Then click the down-pointing arrow and select Weeks.
  2. Select Later, then select Interval and enter 2 in the Frequency field. Then click the down-pointing arrow and select Days.

Answer

You select Later, then select Interval and enter 2 in the Frequency field. Then you click the down-pointing arrow and select Weeks.

3. Reviewing a scheduled backup

The Schedule Backup: Review page displays a summary of the settings you've specified for your database backup.

Recovery Manager (RMAN) uses its own command syntax and scripting language.

You can click Edit RMAN Script to review and customize the RMAN commands that your settings have generated.

If you decide that you want to cancel the backup, you can click Cancel.

You are satisfied with the backup schedule configuration you have chosen, so you want to submit the associated backup job.

You click Submit Job. Then you click OK.

You have successfully submitted your backup job.

Question

Which of these tasks can you perform when reviewing backup settings?

Options:

  1. Cancel the backup job
  2. Override current settings
  3. Review and customize the RMAN commands
  4. Submit the associated backup job

Answer

When reviewing backup settings, you can edit the RMAN script and submit or cancel the job.

Option 1 is correct. To cancel the job, you click the Cancel button.

Option 2 is incorrect. The Override Current Settings option is available on the Schedule Backup: Settings page.

Option 3 is correct. To review and customize the RMAN commands, you click Edit RMAN Script.

Option 4 is correct. When you are satisfied with the backup schedule configuration you have chosen, you submit the associated backup job by clicking Submit Job.

4. Backing up control files to trace

Now you want to back up your control files.

To do this, you click the Administration tab.

Then, in the Storage section, you click Controlfiles.

The Controlfiles page displays.

You should have multiple copies of the control file on separate disks. If one control file is damaged, it can be replaced using a copy from another disk.

Even if you have multiple copies, it is still possible for all of the control files to become lost or damaged.

For this reason, it is good practice to back up the control files to trace each time you make a structural change to the database, such as adding tablespaces, redo log groups or datafiles.

You now want to create trace copies of the control file.

You click Backup To Trace. Then you click OK.

The trace backup is created in the location specified by the USER_DUMP_DEST initialization parameter with a filename such as sid_ora_pid.trc.

The trace file contains information about archive log destinations and SQL commands that create replacement control files.

Alternatively, you can use this SQL command.

ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

Question

Identify the methods you can use to back up control files to trace.

Options:

  1. Issuing Backup To Trace in RMAN
  2. Using a SQL command
  3. Using the Backup To Trace button
  4. Using the Submit J ob button

Answer

You can back up control files to trace by using either the Backup To Trace button or a SQL command.

Option 1 is incorrect. The RMAN backup command does not include the option to back up to trace.

Option 2 is correct. The SQL command you use is ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

Option 3 is correct. The Backup To Trace button is located on the Controlfiles page in Enterprise Manager.

Option 4 is incorrect. You use the Submit Job button in Enterprise Manager to submit your backup job.

Question

Suppose you have just added a new redo log group to your database. You need to back up your control files to trace, starting in the Administration tabbed page of Enterprise Manager.

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

Options:

  1. Click Controlfiles. Then click Backup To Trace. Finally, click OK.
  2. Click Datafiles. Then click Backup To Trace. Finally, click OK.

Answer

You click Controlfiles. Then you click Backup To Trace. Finally, you click OK.

Summary

You should back up your database files regularly to avoid losing information. It can be useful to automate backups by configuring them to occur at regular intervals. Enterprise Manager provides a simple way of scheduling backups. You can choose between Oracle's suggested backup strategy and configuring your own. Opting for a custom strategy gives you a wider range of configuration options.

You can select a location to save your backup files. You can also run the backup immediately or schedule it for a specific time and repeat interval.

Recovery Manager (RMAN) uses its own command syntax and scripting language to implement the backup settings you choose.

You need to back up your control files separately. You should back up the control files to trace whenever you make a structural change to the database, such as adding tablespaces, redo log groups or datafiles.

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.