RMAN

3 Ways to Set RMAN Log Location

RMAN Log Location

RMAN is a client side utility like sqlplus used to interoperate with DB, we usually compose a script file or a batch file to run via cron job or schedule. If any problems result from RMAN, you can check the log file in order to debug them.

There is no RMAN default log location in PFILE to set, so you must add the log location by yourself, if you are not specify one, you will miss the error messages and other important alerts.

There’re 3 ways to reserve RMAN log location for you to trace:

1. OS Level: Using tee

Just piping output to a file and show it in the console as well by using tee.

$ rman target / @full_backup.sql | tee -a /oracle/backup/rman.log

2. Command Level: Using LOG

Using the RMAN keyword LOG to specify the Location of RMAN Output, but the output will not show on you console.

$ rman target / @full_backup.sql LOG '/oracle/backup/rman.log'

3. Statement Level: Using SPOOL

We use SPOOL to output RMAN log to the destination we indicated.
RMAN> SPOOL LOG TO '/oracle/backup/rman.log';
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
RMAN> SPOOL LOG OFF;

Log Files on Daily Basis

The above examples may not be very good practices, because they log everyday’s backup process in the same file. You must empty the file periodically to prevent the log file from growing too large.

A better practice is to log RMAN execution results in separate files based on dates, then you can easily to trace the problem by dates. The following is a sample script that you can use:

#!/bin/bash
...
LOGFILE=/oracle/backup/logs/rman_`date +%Y%m%d`.log
EXEFILE=/oracle/backup/scripts/DailyBackupCmd
...
rman target / @$EXEFILE LOG $LOGFILE
...

For more backup strategies, you may check the post: Routine Backup Strategies (0/5) – An Overview

For fixing the displayed date format in RMAN output, you may check the post: How to Set NLS_DATE_FORMAT in RMAN

Leave a Reply

Your email address will not be published. Required fields are marked *