Oracle RMAN 11g Backup and Recovery- P8 - Pdf 66

318
Part III: Using RMAN Effectively
Jun 11, 2009 3:37:09 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >\>\>\>\>\>\>\> The Database Control URL is
:1158/em <<<<<<<<<<<
Jun 11, 2009 3:45:27 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************ WARNING ************************
Management Repository has been placed in secure mode wherein Enterprise Manager
data will be encrypted. The encryption key has been placed in the file:
/home/oracle/app/oracle/product/11.2.0/dbhome 1/localhost.localdomain dev1/sysman/
config/emkey.ora. Please ensure this file is backed up as the encrypted data
will become unusable if this file is lost.
***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Jun 11, 2009 3:45:27 PM
Configuring Backup Settings in Enterprise Manager
It has taken us a bit of extra time to come to terms with Enterprise Manager, but now we can use
our recently configured OEM Grid or Database Control to take database backups. Hopefully, you
have navigated yourself to the point where you are excited about OEM’s possibilities, and you are
ready to begin scheduling your backups so you can get back to the rest of your day. As we get
started on this section, bear in mind that we are utilizing EM Database Control, not Grid Control,
for this conversation. Thus, we will not be orienting ourselves to a database first—we assume
there is only one database available in the console.
First, we need to get our backup settings dialed in. That means a few page clicks in the
OEM console. All backup- and recovery-related operations will come from the Availability
tab, shown next.
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Chapter 13: Using Oracle Enterprise Manager for Backup and Recovery
319
From the Availability tab, the first thing that you need to do is configure backup settings, so

The Policy tab allows for configuration of those settings that relate to your business backup policy.
This includes turning on autobackups of the control file and SPFILE, and specifying where the
autobackups will be (if disk backups are used). On the Policy tab, you can turn on backup
optimization (see Chapter 3 for details on backup optimization). This is also where you turn on
block change tracking (see Chapter 16) and configure tablespace exclusions (see Chapter 3).
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Chapter 13: Using Oracle Enterprise Manager for Backup and Recovery
321
You also use the Policy tab to configure your retention policy. OEM provides three options:
retain all backups (ack!), set a policy based on a recovery window, or set a policy based on
redundancy. If you choose a recovery window or redundancy, you are required to specify how
many days or how many copies, respectively. After this, you again provide host credentials and
click OK to submit the changes. OEM connects to the target database host and issues the RMAN
configure commands to make these changes.
What Is Missing from OEM’s Backup Configuration?
Not all things that RMAN can configure are configured in OEM. Some changes can be made only
from the RMAN command line:
Backup encryption Encryption is enabled when you schedule a specific backup,
not in the overall backup settings. When you go to schedule an Oracle-Suggested or
Customized Backup, you can specify the Encryption level.
Default device type It could be argued that because you schedule backups within OEM
to repeat, the default device type is not required. Regardless, you will not find it in the
OEM interface.
Archive deletion policy From RMAN, you can set a specific archive log retention policy
that is different from the backup set retention policy. No such option exists in OEM.
Snapshot control file location RMAN allows you to modify the snapshot control file
location, which is handy for RAC configurations. OEM has no way of accomplishing this.
Backup throttling There is no rate command available in any OEM backups, so there
is no way to throttle back the RMAN backup speed. This also holds true for the duration
command that allows you to specify a backup window with the minimize time or

Under Host Credentials, set the host server username and password to the user that
installed your database software. Then click OK.
Step 6.
Confirm that the changes have taken effect for this database. Connect to the host server
where this database resides:
Export ORACLE SID v112
rman target /
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'/u01/backup/%F';

CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/backup/%U'
MAXPIECESIZE 500 M;

CONFIGURE CHANNEL DEVICE TYPE 'SBT TAPE' MAXPIECESIZE 500 M;

Configuring Recovery Settings
After configuring the backup settings, you will need to configure the database recovery settings.
You can access this page from the main Availability tab of the database target by clicking the
Recovery Settings link. Configuring the recovery settings actually covers a wide scope of options.
On the Recovery Settings page, OEM further divides the recovery settings into three types of
recovery: Instance Recovery, Media Recovery, and Flash Recovery, as described in the following
sections.
Instance Recovery

In 11g, a new check box (shown next) has been added to Enable Minimal Supplemental
Logging. This configures the database for additional logging required for using the LogMiner
utility.
Flash Recovery
Under the heading Flash Recovery, you can configure your FRA, providing both an FRA destination
and size. More useful, and unfortunately buried here in a configuration page, is an excellent pie
graph displaying current used space in the FRA, broken down by file type. This is an excellent
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
324
Part III: Using RMAN Effectively
quick view of the FRA that is hard to find anywhere else. Remember it is here under the Flash
Recovery configuration settings; it can save you valuable time down the road.
Why Are My Archive Log and Flash Recovery Options Grayed Out?
If you arrived at the Recovery Settings page only to find the options to turn on ARCHIVELOG
mode and to modify the LOG_ARCHIVE_DEST locations grayed out in OEM (disallowing you
from making changes to the mode or the flash recovery options), you have logged in as a user
that does not have SYSDBA privileges. You must log out of Grid or Database Control, and log
back in as user SYS with the role SYSDBA, to make changes on the Recovery Settings page.
In addition to being where you configure the FRA, the flash recovery area is where you can
turn on Flashback Database, functionality introduced in 10g that can radically reduce point-in-
time recovery by rewinding the database (literally). Flashback Database, and all of the different
configuration requirements and resource needs thereof, are discussed in Chapter 15.
As with ARCHIVELOG mode, turning on Flashback Database requires a database reboot; we
suggest that you do them both at the same time to save yourself a bit of hassle. Along with turning
on Flashback Database, you can set your flashback retention time target, in hours.
Note, finally, the Apply Changes to SPFILE Only check box. Checking this option is the same
as changing parameters like this:
alter database set db recovery file dest '/u01/fra' scope spfile;
Note, of course, that checking this box will not “save” the ARCHIVELOG mode and
Flashback Database changes. Either you restart the database and change them, or you wait

Enterprise Manager cannot actually create a recovery catalog. You still need to manually create
the catalog user, grant the user the RECOVERY_CATALOG_OWNER role, and then connect
RMAN to this user and issue the command create catalog. There is no wizard or anything for
these steps in OEM. This can be a bit confusing, as there is an Add Recovery Catalog button on
the Recovery Catalog Settings page. However, this button only adds an existing recovery catalog
to the Enterprise Manager repository; that is, we make EM aware of the existence of a recovery
catalog, so that it can then add this particular database to the specified catalog.
Once the catalog is created, you can inform OEM that you wish to use the recovery catalog.
After you have registered the recovery catalog with OEM, you can register targets in the catalog. If
you have registered more than one recovery catalog, you can specify that a particular one be put
in use during different backup and recovery operations.
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
326
Part III: Using RMAN Effectively
RMAN Workshop: Register the Recovery Catalog with OEM
Workshop Notes
This workshop creates a catalog in the database emrep manually and then registers it for use in OEM.
Step 1.
Connect to the repository database as user SYS and create the user for the catalog:
SQL> create tablespace reco cat datafile
'/u01/app/oracle/oradata/emrep/reco cat1.dbf' size 100m;
Tablespace created.
SQL> create user rman identified by rman
2 default tablespace reco cat
3 quota unlimited on reco cat;
User created.
SQL> grant connect, resource, recovery catalog owner to rman;
Grant succeeded.
SQL> connect rman/rman
Connected.

Recovery Catalogs View and manage all recovery catalogs that EM has been made
aware of.
Unregister Database Remove this database from the selected recovery catalog
permanently.
Database Backups from Enterprise Manager
Now that you have configured your database for backups from the OEM interface, you can get to
the nitty-gritty of actually taking a backup. From the OEM Console, after you have selected your
database and clicked the Availability tab, click the Schedule Backup link. On the Schedule Backup
page, you are given two options: the Oracle-Suggested Backup or Schedule a Customized Backup.
Oracle-Suggested Backup Strategy
Starting with Oracle Database 10g, Oracle has put together a full backup strategy that is “ready to
wear” straight from the rack. This is available only via OEM (in both Grid Control and Database
Control) and requires the existence of the FRA. The Oracle-suggested strategy checks the backup



Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
328
Part III: Using RMAN Effectively
and recovery settings you’ve configured for your database and draws conclusions about whether
you want a disk-only backup, a tape-only backup, or a combined disk and tape backup.
Disk-Only Oracle-Suggested Backup Strategy
The disk-only backup strategy is the most straightforward. It uses the “incremental apply to
database copy” functionality to create a backup strategy that is self-cleaning. Here’s an example
of how it works. In this example, we start the Oracle-suggested strategy on a Monday evening at
10
P
.
M
. The database is running in ARCHIVELOG mode, has automatic control file and SPFILE

behind the current point in time. This allows for a point-in-time recovery to any point in the
previous 24 hours, but nothing earlier than that. At most, the database backup is 48 hours behind
the current time, so recovery is never that far behind.
There are limitations to this strategy, but that’s one of the drawbacks to a “one-size-fits-all”
approach to backups.
Tape-Only Oracle-Suggested Backup Strategy
The tape-only suggested strategy differs in many ways from the disk-only suggested strategy. First, no
backup will ever be created in the FRA. Sure, archive logs will accumulate there, but all backups
will go directly to the tape device. In addition, the tape-only strategy cannot take advantage of
the incremental apply feature. Remember, an image copy backup cannot be taken to tape. All
backups to tape will be of the backup set type.
When you schedule an Oracle-suggested tape-only backup, two RMAN scripts are generated:
a daily backup and a weekly backup. First, the weekly script is run. This creates a full database
backup, including all archive logs. Then, the daily script is run. The daily backup does an
incremental backup of only changed blocks, along with all archive logs not already backed
up. Then, once a week, the full database backup runs again.





Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Chapter 13: Using Oracle Enterprise Manager for Backup and Recovery
329
During the tape-only backup wizard, if you have not specified a retention policy, OEM asks
you to specify one. Then, as part of the daily backup, your retention policy is enforced on the
tape channel.
After generating a tape-only suggested strategy, you will find that the scripts might look
something like this:
Daily Script:

If you decide to back up archive logs and incrementals to tape daily, this would be the
resulting daily and weekly script that OEM builds:
Daily Script:
run {
allocate channel oem disk backup device type disk;
recover copy of database with tag 'ORA$OEM LEVEL 0';
backup incremental level 1 cumulative
copies 1 for recover of copy with tag
'ORA$OEM LEVEL 0' database;
release channel oem disk backup;
allocate channel oem sbt backup1 type 'SBT TAPE' format '%U' parms
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
330
Part III: Using RMAN Effectively
'nb ora server (horatio.hadba.com)';
backup archivelog all not backed up;
backup backupset all not backed up since time 'SYSDATE-1';
}
allocate channel for maintenance device type 'SBT TAPE' parms
'nb ora server (horatio.hadba.com)';
delete noprompt obsolete recovery window of 7 days device type
'SBT TAPE';
Weekly Script:
run {
allocate channel oem disk backup device type disk;
recover copy of database with tag 'ORA$OEM LEVEL 0';
backup incremental level 1 cumulative copies 1 for recover of copy with tag
'ORA$OEM LEVEL 0' database;
release channel oem disk backup;
allocate channel oem sbt backup1 type 'SBT TAPE' format '%U' parms

1. Choose backup options (what do you want to back up?).
2. Choose backup settings (how do you want to back up?).
3. Schedule the backup (when do you want to back up?).
4. Perform a final review (is everything to your liking?).
On the final review page, you will be presented with the RMAN script that the wizard has
created, as shown in the following example. At this stage, you can either submit the job for
execution or edit the RMAN script from there. This allows you to make any minor tweaks in the
script. Note that if you decide to modify the script manually, OEM warns you that you will not be
able to go back and make any changes in the backup wizard pages. After you make any of your
own changes, you can either cancel them or submit the job.
RMAN Script Job vs. Scheduled Backup Wizard
There is another way to use OEM to schedule and run RMAN backups of a target database. If you
go to the Jobs tab in Grid Control (or the Jobs link under Related Links in Database Control) and
look at the drop-down list of possible job types to create, you will see RMAN Script. This is a
specific type of job specification that allows you to use OEM to execute an RMAN script that
already exists at the target server.
So what is the difference between an RMAN script job and a host command job? Both require
a script to exist prior to scheduling the job. But if you choose an RMAN script job, OEM uses its
built-in mechanisms to ensure that the environment is properly configured for your target database
before running the script. This is a very nice feature, which you know if you have ever run into
the dreaded “compatibility matrix” of RMAN executables versus target databases.
Why Does OEM Always Try to Allocate a Tape Channel for Maintenance?
You may notice that when you review your RMAN script after using the OEM wizard to
schedule a backup, OEM has the following lines:
allocate channel for maintenance type 'SBT TAPE';
delete noprompt obsolete device type disk;
What gives? OEM has this little quirk. If you have, at any point, gone into the Configure
Backup Settings page and set the number of tape drives to some value, then OEM has gone
to your target database and configured a tape channel in the permanent configuration
parameters. Thus, it assumes that any maintenance operation should always check tape

333
Step 4.
Click the Parameters tab. In the text box, provide the full path and name to the backup
script you created on the target server.
Step 5.
On the Credentials tab, ensure that you have selected SYSDBA Database Credentials, as
this is required by RMAN.
Step 6.
On the Schedule tab, set a schedule for the job. Your choice is One Time (Immediately),
One Time (Later), or Repeating. New in 11g, you can also specify a Grace Period for the backup
job: by specifying Indefinite, you are telling EM to let the job run until it signals that it is finished.
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
334
Part III: Using RMAN Effectively
By choosing End After, you are indicating to EM that you want the job killed if it hasn’t completed
in the specified time.
Step 7.
Click the Submit button at the top of the page to send the job to the active jobs page.
This submits the job as a one-time event. You can, alternatively, save the job to the library without
submitting it immediately, or both submit the job now and save it to the library.
Performing Recovery in Enterprise Manager
After seeing all the backing up that can be done from OEM, it should come as no surprise that
you can also perform recovery from OEM. That being said, there are not many situations where
we’ve seen OEM’s recovery options being used—even when OEM is used for backups. The
decision to use OEM for recovery boils down to your ability to mitigate the overwhelming
sensation typically felt when you realize your database is hosed: panic.
OEM does not help you manage your panic very well. You’d think that a GUI would be the
best defense against panic—easy to use, quickly implemented, and all that. But this is actually
quite the opposite of all DBAs’ reactions we’ve seen in a recovery situation. During the most
solemn and distressing recovery situations we’ve been a part of, the one overwhelming DBA

blocks during its last backup. However, some of it will get there only if you run one of the newly
integrated health checkers against the database. These checkers perform diagnostic data gathering
operations on different aspects of the database and then store that data in the Diagnostic
Repository for action by different actors (such as the DRA).
The health checkers and the DRA are native components of the RDBMS in 11.2, so you don’t
need Enterprise Manager to utilize the functionality. There is a fuller discussion on the command-
line DRA in Chapter 3. Here, we are going to focus on the EM interface for the tools. This is one
of those places where the GUI interface really earns its keep—in scheduling health check operations
and in giving you a one-stop location to rectify any outages.
The Checkers in EM
There are seven checkers available in 11.2. Each of these performs actions against different
database objects, or with different architectural needs. Each of these is described next. What
they all have in common is that you get to them in EM from the main database home page, by
scrolling down to Related Links and clicking Advisor Central. Advisor Central offers two pages—
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
336
Part III: Using RMAN Effectively
Advisors and Checkers. Advisors is the default view; you will need to click the Checkers tab to
see the health check utilities.
From the Checkers page, you can see the most recent runs of the checkers and the results.
By clicking on the Run Name, you can move to the Findings page to see if any alerts have been
raised that require action. Each of the checkers may require unique inputs to run, but they all
require at least two items in common: you must name the run you are asking to start (and it must
be unique), and you must provide a time-out after which EM aborts the checker if it has not
completed.
Data Block Integrity Check Checks a single block for corruption. You need to know
the suspected file and block number (such as reported by an ORA-1578 error) to run this
checker.
CF Block Integrity Check This is the Control File checker. Again, the expectation in the
tool is that you know the suspected back block number that requires an integrity check.

If you click the Advise button, EM will take a few moments to examine the information and
then will provide advice on what to do about the particular failure at hand. If there is an action
it can take automatically, it will ask permission and then do so. Otherwise, it will recommend a
manual action to take, as shown next.
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.


Nhờ tải bản gốc
Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status