# Oracle RMAN 11g Backup and Recovery- P8

Chia sẻ: Thanh Cong | Ngày: | Loại File: PDF | Số trang:50

0
116
lượt xem
20

## Oracle RMAN 11g Backup and Recovery- P8

Mô tả tài liệu

Oracle RMAN 11g Backup and Recovery- P8: Oracle, yet another edition of our RMAN backup and recovery book has hit the shelves! Oracle Database 11g has proven to be quite the release to be sure. RMAN has new functionality and whizbang new features that improve an already awesome product. RMAN has certainly evolved over the years, as anyone who started working with it in Oracle version 8 can attest to.

Chủ đề:

Bình luận(0)

Lưu

## Nội dung Text: Oracle RMAN 11g Backup and Recovery- P8

1. 318 Part III: Using RMAN Effectively Jun 11, 2009 3:37:09 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: >\>\>\>\>\>\>\> The Database Control URL is https://horatio.hadba.com:1158/em
2. 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 click the link called Backup Settings. The Backup Settings page has three tabs, Device, Backup Set, and Policy, which are described in the following sections. Device Configuration From the Device tab, shown next, you can set up both disk and tape settings. These settings are not for setting which is the default device, but rather are individual settings for all channels on these devices. For disk backups, you set parallelism, the backup location, and the type of backup (backup set or image copy). This is also where you would turn compression on, if you want to use it. For tape backups, you tell OEM how many tape devices will be employed, and the tape backup type (compressed or noncompressed). In addition, for tapes, you can provide any environment settings that are required for the tape backup software to operate (for more on tape backup settings, see Chapters 4 through 8). Note that at the bottom of the Device tab is a place (not shown in the screen shot) for host credentials. These are required in order for OEM to submit a job to make the desired changes on the target database. This same requirement appears at the bottom of each tab of the Configure Backup Settings page. Backup Set Configuration After making device configuration decisions, click the Backup Set tab, which allows you to make permanent configuration settings for how the backup sets will be generated. Remember, this only applies to those backups that use backup sets instead of image copies (disk backups can be either; tape backups are always backup sets). If you are using disk backups, you have two things to configure here: the maximum size of your backup pieces, and the compression algorithm. The compression choice is between BZIP2 and ZLIB—with the former optimizing for maximum compression (at the cost of CPU cycles), and the latter optimizing for low CPU utilization (at the cost of less compression). If you will be Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
3. 320 Part III: Using RMAN Effectively backing up to tape, you can set up how many copies of each datafile backup set you will create on the tape devices and the number of copies of each archive log backup to create. Policy Settings 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.
4. 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 minimize load options. RMAN Workshop: Configure Backup Settings in OEM Workshop Notes This workshop assumes that you have the v102 database and want to configure it to back up to a disk location other than the FRA with two channels, that you want filesperset to be 2, and that you want a recovery window of seven days. Step 1. Set up the disk backup settings. Click the Availability tab and then click the Backup Settings link. The default page that appears is the Device tab. Change Parallelism to 2 and Disk Backup Location to /u01/backup. Click the Test Disk Backup button to the right to confirm that the location you have specified exists. Step 2. Click the Backup Set tab. Change Maximum Backup Piece (File) Size to 500MB. Change the Compression Algorithm to ZLIB. Step 3. Click the Policy tab. Click the Automatically Backup the Control File and Server Parameter File check box. Set the Autobackup Disk Location to u01/backup (the same location as the backups in Step 1). Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
5. 322 Part III: Using RMAN Effectively Step 4. Under the Retention Policy heading, change the policy to the second option, Retain backups that are necessary for a recovery to any time, and set the value to 7 days. Step 5. 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 Only one setting refers to instance recovery, FAST_START_MTTR_TARGET, as shown next. This is an initialization parameter that determines a target value, in seconds, which you are interested in hitting when instance recovery is initiated on the database. MTTR is an acronym for mean time to recover and is a common name for exactly how long it takes for a database to be operational again after it has crashed for some reason. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
7. 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. 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 and restart the database and change them later. 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. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
8. Chapter 13: Using Oracle Enterprise Manager for Backup and Recovery 325 RMAN Workshop: Configure Recovery Settings in OEM Workshop Notes This workshop makes changes that set a second archive destination in addition to the FRA, add more space to the FRA, and enable Flashback Database. This workshop assumes you are already in ARCHIVELOG mode (see Chapter 3 if you are not, or just choose the ARCHIVE Log check box on the Recovery Settings page). Step 1. Log into OEM as user SYS with role SYSDBA. If you are not logged in as SYS, the options on the Recovery Settings page will be grayed out. Step 2. Navigate to the Database | Availability | Recovery Settings page. Step 3. Set a new archive log destination to /u01/backup. Click Add Another Row and then specify the location (here, we use /home/oracle/backup). Step 4. Change the Flash Recovery Area Size to 4GB. Step 5. Check the Enable Flashback Database check box. Set the Flashback Retention Time to 24 Hours. Step 6. Click the Apply button. This prompts you to restart the database. Click Yes. You then need to provide host and database credentials for the shutdown. Step 7. After the database is restarted, navigate back to the Recovery Settings page to confirm the changes. Configuring Recovery Catalogs in OEM 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.
9. 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. Step 2. Make sure that you have the 11.2 $ORACLE_HOME/bin in your path before this step so that the RMAN executable is 11.2. Otherwise, OEM will not be able to register your catalog!$ echo $PATH /u01/app/oracle/product/10.2.0/bin [oracle@dex oracle]$ rman catalog rman/rman@v112 Recovery Manager: Release 11.2.0.0.2 on Wed Dec 21 Copyright (c) 1982, 2009, Oracle. All rights reserved. connected to recovery catalog database RMAN> create catalog; recovery catalog created Step 3. Now that the catalog is created, go to OEM | Database | Availability | Recovery Catalog Settings. Select Use Recovery Catalog, and then click the Add Recovery Catalog button. From Grid Control, you can choose an already discovered database or provide the host, the port, the SID, and the RMAN username and password. From Database Control, you cannot choose from a list and must provide the host:port:sid combination. In addition, you need to provide the recovery catalog credentials (the RMAN user created in Step 2). Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
12. 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: run { allocate channel oem sbt backup1 type 'SBT TAPE' format '%U' parms 'nb ora server (horatio.hadba.com)'; allocate channel oem sbt backup2 type 'SBT TAPE' format '%U' parms 'nb ora server (horatio.hadba.com)'; backup incremental level 1 cumulative database; backup archivelog all not backed up; } 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 sbt backup1 type 'SBT TAPE' format '%U' parms 'nb ora server (horatio.hadba.com)'; allocate channel oem sbt backup2 type 'SBT TAPE' format '%U' parms 'nb ora server (horatio.hadba.com)'; backup incremental level 0 database; backup archivelog all not backed up; Combined Disk and Tape Oracle-Suggested Backup Strategy When you combine disk backups with tape backups, the hybrid solution demands more input from you than either of the previous Oracle-suggested strategies. And, for the first time, you must make a configuration decision. First, consider the disk part of the strategy. Backups to disk are identical in the combined disk and tape strategy and in the disk-only strategy: a full image copy in the FRA, and then incremental backups each night that are then applied to the image copy. As far as the tape part of the strategy, you must decide how much you want backed up to tape on a daily basis. On a weekly basis, the suggested strategy backs up all recovery-related files (with the backup recovery files command in RMAN). But, you must choose how much to back up daily: nothing, archive logs only, archive logs and incrementals, or archive logs and the full database copy. 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.
13. 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 'nb ora server (horatio.hadba.com)'; backup recovery area; } 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'; Final Note on Oracle-Suggested Strategies Taking a default backup strategy “off the shelf” has its benefits and its drawbacks. The benefits come from being able to “set and forget” the backups—they will run forever and clean themselves up. There is some assurance in having this option, particularly for low-priority development databases that typically are operated by someone other than you. If they come to you in a panic, you can always use these backups to fix the problem and save everyone a lot of headaches. But there is (almost) no customization, and sometimes the default strategy will not match your SLA. The most glaring example of this is in the ability to do point-in-time recoveries to some point in the past (a limitation of the disk-based strategy only). Remember, these strategies are merely Oracle suggestions. You don’t have to use them, and if they are giving you any heartburn, there is a simple answer: drop the suggested strategy and build your own. Scheduling a Customized Backup From the same Availability page where you can choose to schedule an Oracle-suggested backup strategy, you can also choose to build your own customized backup job. This is a wizard-driven process that steps you through the different choices to be made about the backup. When the wizard is finished, you can run the backup as a one-time backup immediately, schedule it for later, or set it up to repeat continually on a schedule. It is important that you take the time to develop a full backup strategy ahead of time, but OEM will provide some guidance about how to develop that strategy. These tips appear as small-font hints under some of the choices you will be asked to make in the Backup Scheduling Wizard. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.