Oracle® Database 2 Day DBA 11g Release 1 (11.1) Part Number B28301-01 |
|
|
View PDF |
This section explain how to set up your database to take advantage of Oracle suggested backup strategies. If you already configured the database for automated backups with the Database Configuration Assistant, then skip this section.
To take maximum advantage of Oracle Database features that automatically manage backup and recovery files and operations, configure your database as follows:
Use a flash recovery area, which automates storage management for most backup-related files, and specify it as an archived redo log destination.
Run the database in ARCHIVELOG
mode so you can perform online backups and have data recovery options such as complete and point-in-time media recovery.
You must also set a number of policies governing which files are backed up, what format is used to store backups on disk, and when files become eligible for deletion. See "Using DBCA to Create and Configure a Database" to learn how to create a database preconfigured for automated daily backups.
You must have the proper credentials to perform some of the configuration tasks for backup and recovery, and to schedule backup jobs and perform recovery. The following credentials may be required:
The Oracle Database user you specify when you log in to Oracle Enterprise Manager Database Control (Database Control)
The host operating system user whose credentials you provide when performing backup and recovery tasks
To enter credentials for backup and recovery tasks:
Log in to Database Control as a database user with SYSDBA
privileges, or provide host operating system credentials for a user in the dba
group on UNIX or Linux, or the ora_dba
group on Microsoft Windows.
The host operating system user must also have execute permission for the RMAN command-line client.
For tasks requiring host operating system credentials, a Host Credentials form appears at the bottom of the page used to perform the task. Enterprise Manager uses the credentials when it starts RMAN jobs that you requested or scheduled.
Optionally, in the Host Credentials form, select Save as Preferred Credential.
If you select this option before performing your action, then the provided credentials are stored persistently for the currently logged-in Oracle Database user. The preferred credentials are reused by default whenever you log in as that user and perform operations requiring host credentials.
Note:
In situations in which the database is shut down, you may still be prompted for host credentials even if you have saved the preferred credentials.You should place the flash recovery area on a separate disk from the working set of database files. Otherwise, the disk becomes a single point of failure for your database.
The amount of disk space to allocate for the flash recovery area depends on the size and activity levels of your database, which determine the size of your datafiles and redo logs files in addition to your recovery objectives. Your objectives dictate what kinds of backups you use, when you make them, and how long to keep them.
Space management in the flash recovery area is governed by a backup retention policy. A retention policy determines when files are obsolete, meaning that they are no longer needed to meet your data recovery objectives.
Retention policies can be based on redundancy of backups or on a recovery window. When using a redundancy-based policy, the flash recovery area considers a backup of a file obsolete only when the RMAN repository has records of a specified number of more recent backups of that file. When using a recovery window-based policy, you specify a time interval in days. Files are obsolete only when they are no longer needed for complete recovery or point-in-time recovery to an SCN within the window. Therefore, a recovery window-based retention policy is recommended.
Even after files in the flash recovery area are obsolete, they are typically not deleted until space is needed for new files. As long as space permits, files recently moved to tape remain on disk to avoid restoring them from tape for a recovery. The automatic deletion of obsolete files and files moved to tape from the flash recovery area makes it a convenient archiving destination. Other destinations require manual deletion of logs.
Oracle Database Backup and Recovery User's Guide explains how to size the flash recovery area. As a general rule, the larger the flash recovery area, the more useful it is. Ideally, the flash recovery area should be large enough for copies of your datafiles and control files, online redo logs, and archived logs needed to recover the database with the backups kept based on the retention policy.
If your backup strategy includes incremental backups, which are described in "Incremental Backups of Datafiles", then add enough space to the flash recovery area for these files. If you can move some backups to tape, then you can reduce the size of the flash recovery area. Note that retrieving files from tape causes longer database restoration and recovery times.
In the Recovery Settings page, you can configure settings for instance recovery, media recovery, and flash recovery. In this section, you configure the flash recovery area and enable archiving for the database.
You can configure a flash recovery area when first creating the database. If you did not perform this task at database creation time, however, then you can create a flash recovery area for your database now.
To configure a flash recovery area and put the database in ARCHIVELOG
mode:
On the host operating system, create a directory to hold the flash recovery area.
Make sure that the permissions for this directory allow the database to create files.
On the Database Home page, click Availability to display the Availability subpage.
In the Backup/Recovery section, click Recovery Settings.
The Recovery Settings page appears.
Complete the following steps:
In the Media Recovery section, select ARCHIVELOG Mode.
If USE_DB_RECOVERY_FILE_DEST
is not already set as an archiving destination, then set it.
This initialization parameter indicates that the flash recovery area should be an archiving destination.
For ease of database management, the best practice is to use the flash recovery area as your only archiving destination.
In the Flash Recovery section, enter the path to the flash recovery area created in Step 1 in Flash Recovery Area Location, and select a value for Flash Recovery Area Size.
Select Enable Flashback Database.
This option specifies that the database should generate Flashback logs in the flash recovery area, enabling you to use Flashback Database. During usual operation, the database occasionally logs images of data blocks to the Flashback logs. The database automatically creates, deletes, and resizes Flashback logs.
Ensure that the Apply changes to SPFILE only box is not selected.
Click Apply to save your changes.
A message prompts you to restart the database.
Click Yes.
The Restart Database: Specify Host and Target Database Credentials page appears.
Enter your host and database credentials, and then click OK.
The Restart Database: Confirmation page appears.
Click Yes to begin the restart operations.
You can click Refresh periodically to monitor the progress of the operation.
Make a consistent (that is, offline) backup of your entire database immediately after switching your database to ARCHIVELOG
mode.
Caution:
You cannot use backups from before the switch toARCHIVELOG
mode to restore and recover the database to a point in time after the switch. Thus, if you do not immediately make a backup after switching, you are running your database without a backup. See "Performing and Scheduling Backups with Database Control" to learn how to make database backups.See Also:
Oracle Database Backup and Recovery User's Guide for more details about configuring a flash recovery area
It is important to monitor space usage in the flash recovery area to ensure that it is large enough to contain backups and other recovery-related files.
To monitor available space in the flash recovery area:
In the High Availability section of the Database Home page, click the link next to Usable Flash Recovery Area (%).
The Recovery Settings page appears.
The Reclaimable Flash Recovery Area (GB) and Free Flash Recovery Area (GB) settings indicate how much space is free.
You can configure a number of backup-related settings and policies. For example, you can determine how backups are stored, which data is backed up, and how long backups are retained. You can also configure settings to optimize backup performance.
This section explains the concepts behind the available settings and also explains how to change them through Database Control. On the Availability page, click Backup Settings to display the Backup Settings page. The settings on the Device subpage affect how RMAN writes backups to disk and to tape.
Database backups created by RMAN are stored as image copies or backup sets.
Image copies are exact byte-for-byte copies of files. You can create an image copy by copying a file at the operating system level. Unlike copying files at the operating system level, however, image copies created through RMAN or Database Control are recorded in the RMAN repository so that RMAN can use these copies during database restoration and recovery. RMAN can only restore files if they are recorded in the RMAN repository. RMAN can only create image copies on disk.
Backup sets are logical entities produced by the RMAN BACKUP
command. This command can produce one or more backup sets on disk or media management devices. RMAN can only write backup sets to a media manager.
Each backup set contains several physical files called backup pieces. A backup piece stores the backup of one or more database files in a compact RMAN-specific format. One advantage of backup sets is that RMAN uses unused block compression to save space in backing up datafiles. Only those blocks in the datafiles that have been used to store data are included in the backup set.
RMAN depends on server sessions, processes that run on the database server, to create backups and restore them. Each server session, in turn, corresponds to an RMAN channel, representing one stream of data to or from a backup device. Channels are either of type disk or type SBT (tape).
RMAN supports parallelism, which is the use of multiple channels and server sessions to carry out the work of one backup or recovery task. Proper use of parallelism can greatly increase performance on backup and recovery tasks.
See Also:
Oracle Database Backup and Recovery User's Guide for an overview of RMAN architecture
Oracle Database Backup and Recovery User's Guide for more conceptual details about RMAN backups
For disk-based backups, you can configure the default format for backups, the location on disk where backups are stored, and whether or not backup tasks run in parallel.
For tape backups, you can configure settings such as the number of tape drives and whether or not backups are compressed. On most platforms, you must integrate a media manager with the Oracle database to use sequential media for storage.
You can use Oracle Secure Backup, which supports both database and file system backups to tape, as your media manager. Oracle Secure Backup provides the same services for RMAN as other third-party SBT interfaces, but is better integrated with Database Control. This section assumes that you will make only disk backups.
To configure backup settings for disk:
On the Database Home page, click Availability to display the Availability subpage.
In the Backup/Recovery section, click Backup Settings.
The Backup Settings page appears.
Click Device.
The Device subpage of Backup Settings appears.
Complete the following steps:
In Parallelism, enter 1
.
Later, when you have had time to review the information in Oracle Database Backup and Recovery User's Guide about parallelism and performance in RMAN, you may want to change this value.
In Disk Backup Location, leave the field blank so that RMAN directs backups to the flash recovery area.
In Disk Backup Type, select Backup Set.
One advantage of backup sets is that RMAN uses unused block compression to save space when backing up datafiles. Only those blocks in the datafiles that have been used to store data are included in the backup set.
In Host Credentials, enter a value for Username and Password.
Host credentials are described in "Specifying Credentials for Backup and Recovery with Database Control".
Click Test Disk Backup to ensure the credentials and backup location are correct.
A message appears that states whether the test was successful.
The settings on the Backup Set subpage should not be changed at this time.
See Also:
Oracle Secure Backup Administrator's Guide to learn how to set up and use Oracle Secure Backup with Database Control
Oracle Database Backup and Recovery User's Guide to learn how to use the RMAN client to configure the default device for backups
You can set the backup policies that govern control file and server parameter file backups, tablespaces to exclude from an entire database backup, and the backup retention policy.
To configure the backup policy settings:
On the Database Home page, click Availability to display the Availability subpage.
In the Backup/Recovery section, click Backup Settings.
The Backup Settings page appears.
Click Policy.
The Backup Policy subpage appears.
Perform the following actions:
Select Automatically backup the control file and server parameter file (SPFILE) with every backup and database structural change. Leave the Autobackup Disk Location field blank so that RMAN stores the automatic backups in the flash recovery area.
The server parameter file and control file are critical to the database and RMAN, and are also relatively small compared to typical datafiles. Backing them up frequently results in relatively little storage overhead.
Select Optimize the whole database backup by skipping unchanged files such as read-only and offline datafiles that have been backed up.
This option saves space in the flash recovery area.
Select Enable block change tracking for faster incremental backups. Either leave Block Change Tracking File blank (if you configured a database area in "Step 7 - Database File Locations") or enter a file name.
This option takes advantage of the block change tracking feature, which greatly improves incremental backup performance at a small cost of overhead.
In the Tablespaces Excluded From Whole Database Backup section, leave the settings as they are.
This feature enables you to specify a list of tablespaces to exclude from a backup. For example, you do not need to include read-only tablespaces in every backup.
In the Retention Policy section, select Retain backups that are necessary for a recovery to any time within the specified number of days (point-in-time recovery). In Days, enter 31
.
This setting enables a recovery window-based retention policy.
In the Archivelog Deletion Policy section, select None.
This option specifies that logs are only eligible for automatic deletion when they have been backed up to tape or are obsolete based on the retention policy.
Click OK to save your changes.
See Also:
Oracle Database Backup and Recovery User's Guide to learn how to configure a backup retention policy