Managing File Copies   «Prev  Next»

Lesson 9

Backup Sets and Image Sets Conclusion

In this lesson, you have become more familiar with the concept of backup sets and image sets. Now that you have completed this module, you should be able to:
  1. Perform online and offline backups
  2. Describe backup sets versus image copies
  3. Identify the use of channels with backup operations
  4. Recognize the use of tags and backups
  5. Create an image copy
  6. Identify why and how to parallelize the creation of image copies
  7. Use the operating system to create image copies
You became familiar with the basic types of backups and examined the image copy type of backup in detail.

Database Backup Glossary Terms

The following terms were introduced in this module:
  1. backup_spec: A variable place holder. The backup_spec is an optional piece of syntax that is used to describe a backup set. You can specify the information such as the datafiles or tablespaces that are included in the set or the tag for the backup set. You can have more than one backup_spec for a BACKUP command, but each backup_spec has to be included within a set of parentheses.
  2. channel_id: A variable place holder, i.e., To allocate a channel, you would use the command ALLOCATE CHANNEL channel_id TYPE type; where channel_id is a unique identifier and type is either DISK, to denote a disk file, or a specific type of third party backup device, such as a tape drive.
  3. filetype: A variable place holder. There are three sets of values you can use for the filetype - datafile, archivelog and current controlfile.
  4. type: A variable place holder. The type option is used to indicate whether the backup is a standard backup, an incremental backup (with the keyword INCREMENTAL) or a cumulative backup ) with the keyword CUMULATIVE), as described earlier in this course, i.e. To allocate a channel, you would use the command ALLOCATE CHANNEL channel_id TYPE type;where channel_id is a unique identifier and type is either DISK, to denote a disk file, or a specific type of third party backup device, such as a tape drive.
  5. tag: A variable place holder. The tag is an optional piece of syntax you can use to specify a name for the backup. This name is included in the information kept in the recovery catalog, so it should describe the purpose of the backup, such as weekly_cumulative_backup.

Backup Command Syntax

run { 
 allocate ch1 type disk;
 allocate ch2 type disk;
 copy datafile 'file1.ora' to 'd:\file2.ora'
 copy datafile 'file3.ora' to 'd:\file4.ora.'
 ;
}             

Format of RMAN Commands

The RMAN language is free-form. Keywords must be separated by at least one white space character (such as a space, tab, or line break). An RMAN command starts with a keyword corresponding to a command. The following example shows an RMAN backup command:
BACKUP DATABASE;

A command can span multiple lines. For example, you can rewrite each keyword in the preceding command on a separate line as follows:
BACKUP
DATABASE;

The maximum length for an RMAN command in a single line is 4000 characters. When a command exceeds this length, you can either split the command into multiple commands or use multiple lines for the command (use the Enter key to make the command span multiple lines).
For example, if a BACKUP command that backs up multiple data files exceeds 4000 characters, then you can either split this command into two separate BACKUP commands or make the single BACKUP command span multiple lines. You can insert a comment by using a pound (#) character at any point in a line. After the # character, the remainder of the line is ignored. For example:

# run this command once each day
BACKUP INCREMENTAL LEVEL 1
FOR RECOVER OF COPY # using incrementally updated backups
WITH TAG "DAILY_BACKUP" # daily backup routine
DATABASE;

@ (at sign) Purpose: Use the @ command to execute a series of RMAN commands stored in an operating system file with the specified path name.
Note: The file must contain complete RMAN commands. Partial commands generate syntax errors.
Prerequisites: The command file must contain complete RMAN commands.
If you use the @ command within a RUN command, then the @ command must be on its own line

Example 6.9.1: Running a Command File from the Operating System Command Line

This example creates an RMAN command file and then executes it from the operating system command line.
% echo "BACKUP DATABASE;" > backup_db.rman
% rman TARGET / @backup_db.rman

Example 6.9.2: Running a Command File Within RMAN This example shows how you can execute a command file from the RMAN prompt and from within a RUN command. User-entered text appears in bold.
RMAN> @backup_db.rman
RMAN> RUN {
2> @backup_db.rman
3> backup database;
4> **end-of-file**
5> }

Example 6.9.3: Specifying Substitution Variables
Suppose that you use a text editor to create command file whole_db.rman with the following contents:
# name: whole_db.rman
BACKUP TAG &1 COPIES &2 DATABASE;
EXIT;

The following example starts RMAN from the operating system prompt and connects to the target database. The example then runs the @ command, passing variables to the command file to create two database backups with tag Q106:
% rman TARGET /
RMAN> @/tmp/whole_db.rman Q106 2

Image Copies - Quiz

Click the Quiz link below to review your understanding of image copies.
Image Copies - Quiz
In the next module, you will learn more about using backup sets.

SEMrush Software