RelationalDBDesign RelationalDBDesign


Backup Recovery   «Prev 

Writing a backup script

Through RMAN, you can specify where to place the backup files by using the format parameter. The %u variables causes RMAN to generate a unique eight-character name for the backup set and the variable %d is for database name.

RMAN creates several client connections, or channels, between the target database and the backup storage device.
RMAN can create backup sets on disk or directory on tape. The FILESPERSET value specifies the maximum number of datafiles that RMAN will write to a backup set. The combination of multiple output channels and files per set govern the parallelism of the operation.

RMAN scripts can be integrated with operating-system command scripts. Routine tasks in the form of commands/scripts can be maintained within the recovery catalog. The script can be executed by calling the procedure, as shown within the RMAN run command:
RMAN > RUN (EXECUTE SCRIPT <script name>;) )

The RMAN backup command can be used to backup archivelog files, data files, tablespaces, etc. You can specify criteria indicating the files to be backed up.

You can be more selective when deciding which archive logs to be backup, and you can delete log files once they are successfully backed up.
Selection criteria can include creation date/time, sequence number, or thread number.
RMAN also performs incremental backups. Unlike the incremental exports, which operate at a table level, RMAN incremental backups back up only changed blocks.
This approach optimizes not only the backup times but recovery operations as well, because RMAN intelligently decides what combination of full, incremental, and archive-log backups will produce the optimal recovery path.

The script starts with RUN statement, which specifies that the following script must be executed. Then, specify where the backup must be saved, i.e. disk or tape and allocate a channel/connection to it.
Next specify the type of backup to be performed and where within the disk/table the backup is saved and what format is the name of the backed up file. By simply specifying the backup and other parameter, this is considered to be in a complete backup of the database.

This is an example of a specific type of backup for the TEMP tablespace