Thursday, August 30, 2007

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.

No comments: