Oracle Secure Backup, Part 3: ConclusionMay 24, 2007 Synopsis. With Oracle Secure Backup, Oracle now offers the capability to insure that all Recovery Manager (RMAN) backups are created and maintained in a secure fashion, all without the need for a potentially expensive and cumbersome media management layer (MML). This article the final one in this series shows how to use an Oracle Secure Backup (OSB) configuration to perform Oracle 10gR2 Recovery Manager (RMAN) restore and recovery operations against previously-created RMAN backups stored on simulated OSB virtual libraries and tape devices. It also demonstrates how OSB can be used for backup and restoration of operating system files. The previous article in this series provided a simple example of how to set up the Oracle Secure Backup (OSB) environment, how to create Oracle 10gR2 Recovery Manager (RMAN) backup sets directly on an OSB virtual tape drive, and how to use the RMAN BACKUP RECOVERY AREA; command to back up the contents of an Oracle 10gR2 databases Flash Recovery Area directly to an OSB virtual tape library. Of course, preparing an alternate media backup set is just half the battle! As those of us who have participated in a cold metal disaster recovery exercise can attest, tape backups are useless unless they can be restored directly from an alternate media source and then used to recover an Oracle 10gR2 databases control files, archived redo logs, and datafiles. Ill next demonstrate how simple it is to restore files from OSB backups to their appropriate destinations as part of a simulated RMAN restore and recovery operation. Performing RMAN Restore and Recovery Operations with OSB BackupsIll use the database image copies that were created directly on simulated OSB alternate media during the demonstrations in the prior article as the source for my datafile restoration attempts. Since I also created OSB backups of the image copies in my databases Flash Recovery Area (FRA), Ive first deleted those backups from the FRA so that RMAN would not consider them as candidates for restoration. Listing 3.1 shows the commands I executed to clean up these backup sets. Now that RMAN will correctly recognize just the backup sets on the OSB virtual tape drive, Ill simulate the cold-metal restoration of two datasets. First, Ill prepare for the simulation by deleting the corresponding datasets for my databases SYSTEM and USERS tablespaces, and then force a shutdown of the database by killing its SMON background process. As Listing 3.2 shows, the database cannot be opened until both datasets have been restored and recovered. Since the SYSTEM tablespaces datafile has been destroyed, Ill need to restore and recover it first. (Remember that the corruption or destruction of either the SYSTEM or UNDO tablespaces requires a shutdown and restart of the database before restoration and recovery of these tablespaces may proceed.) Once thats complete, Ill proceed to restore and recover the USERS tablespace. Listing 3.3 shows the results of these successful RMAN operations. Note that RMAN immediately identifies the required datafiles on the virtual OSB tape drive and performs their restoration without any additional DBA interaction. Creating OSB Backups of Operating System FilesWhile these RMAN backup and restore features are already quite impressive, OSB also offers the capability to back up operating system files stored anywhere on an identified host server to alternate media devices. Though DBAs are typically much more interested in creating tape backups of their Oracle 10gR2 database files, the array of file types that need to be backed up (and restored!) has expanded to include DataPump Import and Export dump sets and the flat files that comprise the raw data thats read by Oracle external tables. Moreover, beginning in Oracle 10gR2, its now possible to create external tables and their corresponding datasets via the CREATE TABLE AS SELECT command (normally assigned the affectionate acronym of CTAS) when its used with the ORACLE_DATAPUMP access method. To prepare for this demonstration, Ive used Oracle DataPump Export to create a dumpset that contains approximately 45MB of exported data in a directory named /home/oracle/expfiles. Ive also invoked a CTAS command against the SH.SALES sample table. Since Ive specified the ORACLE_DATAPUMP access method, Oracle 10gR2 will write out the external tables datasets and generate logging files in a directory named /home/oracle/extfiles. Listing 3.4 shows the code I executed to complete these tasks. Creating an OSB Dataset. Before I can create an OSB backup of OS files, Ill need to define an OSB dataset. Ill use obtools mkds command set: #> obtool --user admin --password oracle < /home/oracle/mkds.obp Heres the contents of mkds.obp:
mkds --input exportdir.ds
include host 10gBUR {
include path /home/oracle/expfiles
include path /home/oracle/extfiles
}
.
yes
To break down this command and its corresponding parameter files syntax:
(By the way, the last two lines of the parameter file the period (.) and the word yes are used to reply to prompts that the OSB mkds command set signals to the console.) Creating an OSB OS File System Backup. Now that the OSB dataset is created, Im ready to create an OSB backup set that contains all of the files specified within the OSB dataset. To accomplish this, Ill use obtools backup command set: #> obtool --user admin --password oracle < /home/oracle/bkupds.obp Heres the contents of bkupds.obp: backup -l full -p 100 -g -D exportdir.ds backup --go Heres a breakdown of the first line in this parameter file, which actually schedules this backup task as a one-time OSB job:
The second line in this parameter file actually starts the OSB file system backup because it contains the --go: directive, which tells OSB to start any scheduled backups. Viewing the Results of OSB Backup and Restore OperationsOnce Ive scheduled and initiated the one-time backup of these OS files, whats the best way to determine if the backup operation has been successful? The good news is that OSB provides several simple methods to list what backup and restore tasks have completed, as well as detailed transcripts for each OSB operation:
Ive provided samples of these two commands, as well as the output they produce, in Listing 3.5. Restoring OSB Backups of Operating System FilesNow that Ive completed backing up the contents of the two export file directories listed in the exportfiles.ds OSB dataset specification, Ill simulate the loss of these files (by deleting them from each directory with the rm f command) and then Ill attempt to restore them to their original location on the OS file system. Note that since I excluded any files that had a file extension of *.log in the /home/oracle/extfiles directory, I expect that only two of the original five files in that directory should be restored. Restoring OS files from OSB Backup Sets. To perform a one-time restore of the files from the most recent OSB backup, Ill use the OSB restore command set. This time, Ill actually invoke the commands one by one from within the obtool command console: ob> restore -h 10gBUR -d vt -G -e -p 100 -s latest /home/oracle/expfiles ob> restore -h 10gBUR -d vt -G -e -p 100 -s latest /home/oracle/extfiles Heres how OSB interprets the parameters in these two commands:
To see what restoration jobs have been submitted, Ill issue the lsrestore command: ob> lsrestore Item Restore data saved from... To... # Host Path Host Path 1 10gBUR /home/oracle/expfiles 10gBUR (original location) 2 10gBUR /home/oracle/extfiles 10gBUR (original location) Finally, Ill start the OSB file system restoration activities with the restore go command: ob> restore -go Info: 2 catalog restore request items submitted; job id is admin/9. To prove that the files have been successfully restored, Ive listed the contents of the directories after the restoration job has completed in Listing 3.6. Note that as expected, the /home/oracle/extfiles directory now omits all but two of the original five files in that directory. ConclusionOracle Secure Backup (OSB) is relatively simple to configure via either the obtool command line tool, the OSB web tool, or Enterprise Manager. OSB permits the creation of virtual tape libraries and virtual tape drives so that tape backup methods and backup scripts can be evaluated without an initial purchase of expensive tape libraries or network appliances. Once its initially configured, OSB integrates seamlessly into existing Oracle 10gR2 Recovery Manager (RMAN) backup scripts that require alternate media targets to implement a comprehensive disaster recovery scheme for Oracle 10gR2 database files. Finally, OSB provides robust backup and recovery methods for operating system datasets, including the capability to create delta versions of these datasets. References and Additional ReadingEven though Ive hopefully provided enough technical information in this article to encourage you to explore with these features, I also strongly suggest that you first review the corresponding detailed Oracle documentation before proceeding with any experiments. Actual implementation of these features should commence only after a crystal-clear understanding exists. Please note that Ive drawn upon the following Oracle 10gR2 documentation for the deeper technical details of this article: B14194-03 Oracle Backup and Recovery Reference B14234-02 Oracle Secure Backup Administrators Guide B14235-05 Oracle Secure Backup Installation Guide B14236-02 Oracle Secure Backup Reference B25049-01 Oracle Secure Backup Migration Guide B32120-01 Oracle Secure Backup ReadMe And dont forget that the Oracle Technology Network (OTN) Oracle Secure Backup home page is an excellent source of valuable (and constantly updated!) information. |