2.1. RMAN Commands

The RMAN utility has a rich command set that is used to support the backup and restore operations of an Oracle database. The Oracle Database Recovery Manager Reference, 10g Release 1 (10.1), part number B10770-02, contains the complete list of commands and diagrams of how to utilize each command. In addition, this document has a listing of key and reserved words. This document is a valuable asset to utilizing RMAN commands and working with RMAN in general.

Table 2.1 lists all commands and clauses from the Oracle Database Recovery Manager Reference, 10g Release 1 (10.1). These are all the available commands and clauses that can be used in RMAN. These commands can be used interactively or in RMAN scripts that run these commands and clauses as a small program.

Table 2.1. RMAN Commands and Clauses
CommandDescription
@Run a command file.
@@Run a command file in the same directory as another command file that is currently running. The @@ command differs from the @ command only when run from within a command file.
ALLOCATE CHANNELEstablish a channel, which is a connection between RMAN and a database instance.
ALLOCATE CHANNEL FOR MAINTENANCEAllocate a channel in preparation for issuing maintenance commands such as DELETE
allocOperandListA subclause that specifies channel control options such as PARMS and FORMAT.
ALTER DATABASEMount or open a database.
archivelogRecordSpecifierSpecify a range of archived redo logs files.
BACKUPBack up database files, copies of database files, archived logs, or backup sets.
BLOCKRECOVERRecover an individual data block or set of data blocks within one or more datafiles.
CATALOGAdd information about a datafile copy, archived redo log, or control file copy to the repository.
CHANGEMark a backup piece, image copy, or archived redo log as having the status UNAVAILABLE or AVAILABLE; remove the repository record for a backup or copy; override the retention policy for a backup or copy.
completedTimeSpecSpecify a time range during which the backup or copy completed.
CONFIGUREConfigure persistent RMAN settings. These settings apply to all RMAN sessions until explicitly changed or disabled.
CONNECTEstablish a connection between RMAN and a target, auxiliary, or recovery catalog database.
connectStringSpecSpecify 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.
CONVERTConverts datafile formats for transporting tablespaces across platforms.
CREATE CATALOGCreate the schema for the recovery catalog.
CREATE SCRIPTCreate a stored script and store it in the recovery catalog.
CROSSCHECKDetermine whether files managed by RMAN, such as archived logs, datafile copies, and backup pieces, still exist on disk or tape.
datafileSpecSpecify a datafile by filename or absolute file number.
DELETEDelete backups and copies, remove references to them from the recovery catalog, and update their control file records to status DELETED.
DELETE SCRIPTDelete a stored script from the recovery catalog.
deviceSpecifierSpecify the type of storage device for a backup or copy.
DROP CATALOGRemove the schema from the recovery catalog.
DROP DATABASEDelete the target database from disk and unregister it.
DUPLICATEUse backups of the target database to create a duplicate database that you can use for testing purposes or to create a standby database.
EXECUTE SCRIPTRun an RMAN stored script.
EXITQuit the RMAN executable.
fileNameConversionSpecSpecify patterns to transform source to target filenames during BACKUP AS COPY, CONVERT, and DUPLICATE.
FLASHBACKReturn the database to its state at a previous time or system change number (SCN).
formatSpecSpecify a filename format for a backup or copy.
HOSTInvoke an operating system command-line subshell from within RMAN or run a specific operating system command.
keepOptionSpecify that a backup or copy should or should not be exempt from the current retention policy.
LISTProduce a detailed listing of backup sets or copies.
listObjListA subclause used to specify which items will be displayed by the LIST command.
maintQualifierA subclause used to specify additional options for maintenance commands such as DELETE and CHANGE.
maintSpecA subclause used to specify the files operated on by maintenance commands such as CHANGE, CROSSCHECK, and DELETE.
obsOperandListA subclause used to determine which backups and copies are obsolete.
PRINT SCRIPTDisplay a stored script.
QUITExit the RMAN executable.
recordSpecA subclause used to specify which objects the maintenance commands should operate on.
RECOVERApply redo logs and incremental backups to datafiles restored from backup or datafile copies in order to update them to a specified time.
REGISTERRegister the target database in the recovery catalog.
RELEASE CHANNELRelease a channel that was allocated with an ALLOCATE CHANNEL command.
releaseForMaintRelease a channel that was allocated with an ALLOCATE CHANNEL FOR MAINTENANCE command.
REPLACE SCRIPTReplace an existing script stored in the recovery catalog. If the script does not exist, then REPLACE SCRIPT creates it.
REPORTPerform detailed analyses of the content of the recovery catalog.
RESET DATABASEInform RMAN that the SQL statement ALTER DATABASE OPEN RESETLOGS has been executed and that a new incarnation of the target database has been created, or reset the target database to a prior incarnation.
RESTORERestore files from backup sets or from disk copies to the default or to a new location.
RESYNCPerform 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.
RUNExecute a sequence of one or more RMAN commands, which are one or more statements executed within the braces of RUN.
SENDSend a vendor-specific quoted string to one or more specific channels.
SETSet the value of various attributes that affect RMAN behavior for the duration of a RUN block or a session.
SHOWDisplay the current CONFIGURE settings.
SHUTDOWNShut down the target database. This command is equivalent to the SQL*Plus SHUTDOWN command.
SPOOLWrite RMAN output to a log file.
SQLExecute a SQL statement from within RMAN.
STARTUPStart up the target database. This command is equivalent to the SQL*Plus STARTUP command.
SWITCHSpecify 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 ALTER DATABASE RENAME FILE as it applies to datafiles.
UNREGISTER DATABASEUnregister a database from the recovery catalog.
untilClauseA subclause specifying 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.
UPGRADE CATALOGUpgrade the recovery catalog schema from an older version to the version required by the RMAN executable.
VALIDATEExamine 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.

The following is an example of performing a job command from multiple RMAN commands in a RUN block. These commands can be grouped together inside the RUN command and brackets {}. This allows you to group multiple commands together and run them as if they were one command.

There are benefits of grouping commands together in a RUN block, which allows you to perform different types of backups such as weekly or monthly backups. You may want to back up only part of the database or the whole database. These RUN blocks can be saved as RMAN scripts, which can be called for these repeated backup tasks. This keeps consistency in the backup process because you eliminate some of the user interaction that occurs when running RMAN commands interactively.

Let's look at grouping commands together into a RUN block. This example will perform a complete database backup stored in a special format and will use the TAG command to name the backup monthly_backup. The archive logs will be stored in a special format as well. Let's walk through running the RUN block.

Here is the script:

RMAN> run
2> {
3> allocate channel c1 type disk;
4> backup database format 'db_%u_%d_%s' tag monthly_backup;
5> backup format 'log_t%t_s%s_p%p'
6> (archivelog all);
7> }

allocated channel: c1
channel c1: sid=162 devtype=DISK

Starting backup at 18-JUL-04
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=C:ORACLEORADATAORA101CSYSTEM01.DBF
input datafile fno=00003 name=C:ORACLEORADATAORA101CSYSAUX01.DBF
input datafile fno=00005 name=C:ORACLEORADATAORA101CEXAMPLE01.DBF
input datafile fno=00002 name=C:ORACLEORADATAORA101CUNDOTBS01.DBF
input datafile fno=00004 name=C:ORACLEORADATAORA101CUSERS01.DBF
channel c1: starting piece 1 at 18-JUL-04
channel c1: finished piece 1 at 18-JUL-04
piece handle=C:WINDOWSSYSTEM32DB_0DFR66MU_ORA101C_13 comment=NONE
channel c1: backup set complete, elapsed time: 00:02:07
Finished backup at 18-JUL-04

Starting backup at 18-JUL-04
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=59 recid=54 stamp=528701976
input archive log thread=1 sequence=60 recid=55 stamp=529542042
input archive log thread=1 sequence=61 recid=56 stamp=529542953
channel c1: starting piece 1 at 18-JUL-04
channel c1: finished piece 1 at 18-JUL-04
piece handle=C:WINDOWSSYSTEM32LOG_T531831661_S14_P1 comment=NONE
channel c1: backup set complete, elapsed time: 00:01:11
Finished backup at 18-JUL-04
Starting Control File Autobackup at 18-JUL-04

piece handle=C:ORACLESTAGINGORA101CCF_C-1736563848-20040718-00 comment=NONE Finished Control File Autobackup at 18-JUL-04
released channel: c1

RMAN>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset