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.
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>