Week Three LabFor this week we will continue to use DB101 as our target database.The goal for this week’s lab is begin to understand more fully how BACKUPS run within RMAN. There a number of different ways that backups can be run and scheduled. With the advent of the Oracle 12c Multitenant architecture there are additional factors that need to be considered. If your database includes a CONTAINER database and PLUGGABLE databases, there areBacking up an enterprises database so that they are available for a possible database restore and recovery is at the core of the duties of the DBA. The DBA must ensure that databases are backedup are regular intervals, and validated so that the DBA knows that with certainty that these backups can be used to restore the database. In this lab we will look the various types of backups that can be employed in an overview backupstrategy. In today’s computing environment applications are frequently required to run in a 24x7 mode. Consequently, the databases that constitute the backend of these applications cannot be taken down to backup the database in a consistent manner. This portion of the lab will walk you through the inconsistent or hot backup. The RMAN utility allows for the use the many of the commands hat we looked in the previous lab, to backup the database, archived log and other database structures. Whenever we log into the Oracle database we need to set our environment so that all of the Oracle environmental variables are set, so that we can connect to the correct Oracle database. Forthe purposes of our labs we will be using using two databases, DB101 (our target database) and RMANCAT (the database containing the RMAN CATALOG schema)1.Completing a HOT backup of the database.2.Once you have logged into the server with the Oracle shell account, set the Oracle environmental variables and the ORACLE_SID variable to the target database.3. There is a a file in the Oracle Home directory, /home/oracle, named profile. The content of this file contains variables such as ORACLE_HOME and PATH. This path needs to besourced she the shell has the variables set. This is completed at the OS level.$ . profileYou can check to see if the environment is set up properly by typing the ENV command.
$ envThe ORACLE_SID is set separately since we have two databases running on this server. $ export ORACLE_SID=db1014.Now we need to initialize the RMAN utility and connect to the TARGET and CATALOG.$ rmanRecovery Manager: Release 126.96.36.199.0 - Production on Sat Oct 10 16:39:39 2015Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.RMAN>At this point we have only stared up RMAN. We have no connection to the target database or the RMAN catalog. Note here that the name of the ORACLE_SID or the DBID may not match your environment. As long as you have connected properly to your TARGET database you should be able to run the lab objectives properly.Now connect to your TARGET database.RMAN> connect targetconnected to target database: SPOCK (DBID=3181554993)In the previous lab, we looked at important ORACLE files. One of these files was theTNSNAMES.ORA files. To connect the CATALOG we will be using an alias set in thatfile. (10 points)RMAN> connect catalog rmanowner/R1d3c0l0@rman5.Now you are connected to RMAN, your target database and the RMAN catalog. We are now ready to complete many of the tasks require to both backup and maintain our environment. While you are still connected to RMAN backup your database. This first backup will bevery straightforward, without any of the options that are available to Oracle. (10 points)RMAN> backup database;
This command, without any options will backup the database to its default location the FLASH RECOVERY AREA. Backups can take a significant amount of disk space, which as a DBA you are responsible for maintaining effectively. One of the ones to manage the location of the backup sets is to user the FORMAT option. Using the FORMAT option backup the database again.RMAN> backup format '/db_backup/db101/bk_%s_%p_%t' database; (10 points)This FORMAT command will direct RMAN to backup to the new location and name the Backupsets so the names are more easily read and understood. This backup is INCONSISTENT, since it is considered a HOT backup, taken while database is OPEN. 6.As stated earlier, the RMAN utility can be used to backup other database structures, not simply backing up the entire database. The REDO LOG files are a record of transactions that occur in the database. If the database is running in ARCHIVELOG mode, it will save the ARCHIVED LOG FILES to a designated location. If not properly maintained, the ARCHIVED LOG FILES can build up, taking up disk space and if not backed up andremoved from DISK, Oracle can stop operating, waiting for enough space to archive the REDO LOGS. The command to backup the ARCHIVED LOG FILES is similar to the backup commandfor the database. In your environment issue the command to backup the ARCHIVED LOG FILES. (10points)RMAN>backup format '/db_backup/db101/arch_%s_%p_%t' archivelog all deleteinput; Notice the difference between this command and the previous database backup command. The FORMAT command has name the backupset will contain the prefix of “arch” so the Backupsets can be distinguished from the backupsets of the database. What has been added to the command is also “all delete input”. This option tells RMAN to backup the the ARCHIVED LOG FILES and then delete them from disk. These files nolonger need to reside on disk, but are still important to the RECOVERY process. 7.While, in most case, the database will need to be backed up while still operating, there will be occasions in which the database will be backed up while it is shutdown. This backup is considered CONSISTENT, since all buffered data has been written to disk.