Oracle® Database Backup and Recovery Reference 11g Release 1 (11.1) Part Number B28273-01 |
|
|
View PDF |
This chapter includes the following topics:
All RMAN commands in Chapter 2, "RMAN Commands" are organized into the following sections:
Purpose This section provides a brief description of the command and the most common circumstances in which it is used.
Prerequisites This section lists the prerequisites for using the command.
Usage Notes This optional section provides general notes about using the command. Notes specific to a command option are included with the option description.
Syntax The syntax diagrams show the keywords and parameters that make up the statement.
Caution:
Not all keywords and parameters are valid in all circumstances. Be sure to refer to the "Semantics" section of each statement and clause to learn about any restrictions on the syntax.Semantics
This section describes the purpose of the keywords, parameter, and clauses that make up the syntax, as well as restrictions and other usage notes that may apply to them. The conventions for keywords and parameters used in this chapter are explained in
"Conventions".Examples This section shows how to use the various clauses and parameters of the statement.
Optional sections following the examples provide more information on how and when to use the statement.
Syntax descriptions are provided in this book for RMAN command-line constructs in graphic form or Backus Naur Form (BNF). See Oracle Database SQL Language Reference for general information about how to interpret syntax diagrams and BNF notation. This section explains RMAN conventions exclusively.
Recovery Manager syntax diagrams use lines and arrows to show syntactic structure, as shown in the following example for the CATALOG
command.
catalog::=
This section describes the components of syntax diagrams and gives examples of how to write RMAN commands. Syntax diagrams are made up of these items:
Keywords have special meanings in Recovery Manager syntax. In the syntax diagrams, keywords appear in rectangular boxes and an uppercase font, like the word CATALOG
in the example diagram. When used in text and code examples, RMAN keywords appear in uppercase, monospace font, for example, CATALOG
DATAFILECOPY
. You must use keywords in RMAN statements exactly as they appear in the syntax diagram, except that they can be either uppercase or lowercase.
Placeholders in syntax diagrams indicate non-keywords. In the syntax diagrams, they appear in ovals, as in the word integer in the example diagram. When described in text, RMAN placeholders appear in lowercase italic, for example, 'filename'. Placeholders are usually:
Names of database objects (tablespace_name)
Oracle datatype names (date_string)
Subclauses (datafileSpec)
When you see a placeholder in a syntax diagram, substitute an object or expression of the appropriate type in the RMAN statement. For example, to write a DUPLICATE
TARGET
DATABASE
TO
'database_name' command, use the name of the duplicate database you want to create, such as dupdb
, in place of the database_name placeholder in the diagram.
The only system-independent, legal environment variables in RMAN quoted strings are a question mark (?
) for the Oracle home and an at-sign (@
) for the SID. However, you can use operating system-specific environment variables on the target system within quoted strings. The environment variables are interpreted by the database server and not the RMAN client.
The following table shows placeholders that appear in the syntax diagrams and provides examples of the values you might substitute for them in your statements.
Placeholder | Description | Examples |
---|---|---|
Quoted strings such as 'filename ', 'tablespace_name ', 'channel_name ', 'channel_parms ' |
A string of characters contained in either single or double quotes. A quoted string may contain white space, punctuation, and RMAN and SQL keywords. | "?/dbs/cf.f"
|
Nonquoted strings such as channel_id , tag_name , date_string |
A sequence of characters containing no white space and no punctuation characters and starting with an alphabetic character. | ch1 |
integer |
Any sequence of only number characters. | 67843 |
The RMAN syntax diagrams shows some placeholder values enclosed in required or optional quotes. The syntax diagrams show single quotes, though in all cases double quotes are also legal in RMAN syntax. For example, you may specify either 'filename' or "filename". For the SQL
command, it is recommended that you use double quotes because the SQL statement itself may also contain a quote, and the most common type of quote in a SQL statement is a single quote. Single and double quotes do not mean the same in SQL as they do in RMAN.
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 one of the commands described in Chapter 2, "RMAN Commands", followed by arguments and ending with a semicolon, as shown in the syntax diagrams. 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 ;
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;
The RMAN language contains a number of reserved words, which are or have been used in RMAN commands. Table 1-1 lists all of the current reserved words.
Table 1-1 RMAN Reserved Words
A-C | C-D | D-L | L-P | P-S | S-W |
---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you must use one of the reserved words as an argument to an RMAN command (for example, as a filename, tablespace name, tag name, and so on), then surround it with single or double quotes. Otherwise, RMAN cannot parse your command correctly and generates an error. Example 1-1 shows correct and incorrect usage of RMAN reserved words in RMAN commands.
Example 1-1 Using Reserved Words as Arguments to RMAN Commands
ALLOCATE CHANNEL backup DEVICE TYPE DISK; # incorrect ALLOCATE CHANNEL "backup" DEVICE TYPE DISK; # correct BACKUP DATABASE TAG full; # incorrect BACKUP DATABASE TAG 'full'; # correct
In general, avoid using reserved words in ways that conflict with their primary meaning in the RMAN command language.
Table 1-2 provides a functional summary of RMAN commands that you can execute at the RMAN prompt, within a RUN
command, or both. All commands from previous RMAN releases work with the current release, although some commands and options are now deprecated (see Appendix A, "Deprecated RMAN Commands"). For command-line options for the RMAN client, refer to RMAN
.
Table 1-2 Recovery Manager Commands
Command | Purpose |
---|---|
|
Run a command file. |
|
Run a command file in the same directory as another command file that is currently running. The |
|
Display repair options. |
|
Establish a channel, which is a connection between RMAN and a database instance. |
|
Allocate a channel in preparation for issuing maintenance commands such as |
|
Mount or open a database. |
|
Back up database files, copies of database files, archived logs, or backup sets. |
|
Add information about file copies and user-managed backups to the repository. |
|
Mark a backup piece, image copy, or archived redo log as having the status |
|
Configure persistent RMAN settings. These settings apply to all RMAN sessions until explicitly changed or disabled. |
|
Establish a connection between RMAN and a target, auxiliary, or recovery catalog database. |
|
Convert datafile formats for transporting tablespaces and databases across platforms. |
|
Create the schema for the recovery catalog. |
|
Create a stored script and store it in the recovery catalog. |
|
Determine whether files managed by RMAN, such as archived logs, datafile copies, and backup pieces, still exist on disk or tape. |
|
Delete backups and copies, remove references to them from the recovery catalog, and update their control file records to status |
|
Delete a stored script from the recovery catalog. |
|
Remove the schema from the recovery catalog. |
|
Delete the target database from disk and unregisters it. |
|
Use backups of the target database to create a duplicate database that you can use for testing purposes or to create a standby database. |
|
Run an RMAN stored script. |
|
Quit the RMAN executable. |
|
Returns the database to its state at a previous time or SCN. |
|
Grants privileges to a recovery catalog user. |
|
Invoke an operating system command-line subshell from within RMAN or run a specific operating system command. |
|
Imports the metadata from one recovery catalog into a different recovery catalog. |
|
Produce a detailed listing of backup sets or copies. |
|
Display a stored script. |
|
Exit the RMAN executable. |
|
Apply redo logs and incremental backups to datafiles or data blocks restored from backup or datafile copies, in order to update them to a specified time. |
|
Register the target database in the recovery catalog. |
|
Release a channel that was allocated with an |
|
Repair one or more failures recorded in the automated diagnostic repository. |
|
Replace an existing script stored in the recovery catalog. If the script does not exist, then |
|
Perform detailed analyses of the content of the recovery catalog. |
|
Inform RMAN that the SQL statement |
|
Restore files from backup sets or from disk copies to the default or a new location. |
|
Perform a full resynchronization, which creates a snapshot control file and then copies any new or changed information from that snapshot control file to the recovery catalog. |
|
Revoke privileges from a recovery catalog user. |
|
Start RMAN from the operating system command line. |
|
Execute a sequence of one or more RMAN commands, which are one or more statements executed within the braces of |
|
Send a vendor-specific quoted string to one or more specific channels. |
|
Set the value of various attributes that affect RMAN behavior for the duration of a RUN block or a session. |
|
Display the current |
|
Shut down the target database. This command is equivalent to the SQL*Plus |
|
Write RMAN output to a log file. |
|
Execute a SQL statement from within Recovery Manager. |
|
Start up the target database. This command is equivalent to the SQL*Plus |
|
Specify that a datafile copy is now the current datafile, that is, the datafile pointed to by the control file. This command is equivalent to the SQL statement |
|
Create transportable tablespace sets from backup for one or more tablespaces. |
|
Unregister a database from the recovery catalog. |
|
Upgrade the recovery catalog schema from an older version to the version required by the RMAN executable. |
|
Examine a backup set and report whether its data is intact. RMAN scans all of the backup pieces in the specified backup sets and looks at the checksums to verify that the contents can be successfully restored. |
Subclauses are used in multiple commands are documented in a separate chapter to avoid unnecessary duplication. The descriptions of commands that use these subclauses include a cross-reference to the subclause entry in Chapter 3, "RMAN Subclauses". Table 1-3 summarizes the RMAN subclauses.
Table 1-3 Recovery Manager Subclauses
Subclause | Specifies . . . |
---|---|
|
Channel control options such as |
|
A range of archived redo log files. |
|
A time range during which the backup or copy completed. |
|
The username, password, and net service name for connecting to a target, recovery catalog, or auxiliary database. The connection is necessary to authenticate the user and identify the database. |
|
A datafile by filename or absolute file number. |
|
The type of storage device for a backup or copy. |
|
Patterns to transform source to target filenames during |
|
All databases in a Data Guard environment or a database with the specified |
|
A range of foreign archived redo log files. |
|
A filename format for a backup or copy. |
|
A backup or copy should or should not be exempt from the current retention policy. |
|
Items that will be displayed by the |
|
Additional options for maintenance commands such as |
|
Files operated on by maintenance commands such as |
|
Backups that are obsolete according to specified criteria. |
|
Objects that the maintenance commands should operate on. |
|
A tempfile by path or by file number. |
|
An upper limit by time, SCN, or log sequence number. This clause is usually used to specify the desired point in time for an incomplete recovery. |