Create a Batch Script for Oracle RMAN Backup with Logging

You may want to run Oracle Backups using the regular Windows Task Scheduler. A simple batch file can be created for this purpose using below command. If you have multiple databases it would be wise to specify the ORACLE_SID

set ORACLE_SID=<targetdb>
rman target / catalog rmanuser/password@catalogdatabase script=<rman_script_name>

Example:  Target Database: orcl | Recovery Catalog Username /Password: rman/pwdrman | Recovery Catalog DB: rmandb

set ORACLE_SID=orcl
rman target / catalog rman/password@rmandb script=LEVEL1_BACKUP

Enabling Logging

To enable logging for your entire backup session, you can explicitly define it in the batch file itself, as illustrated below. The APPEND keyword ensures the file in rewritten in the next backup schedule.

rman target / catalog rman/password@rmandb log c:\TEMP\Oracle_backup.log APPEND script=LEVEL1_BACKUP

 

Advertisements