Database Reference
In-Depth Information
,TO_CHAR(end_time,'dd-mon-yy hh24:mi') as end_time
FROM v$rman_backup_job_details
ORDER BY end_time;
Here is some sample output:
SESSION_RECID COMPRESSION_RATIO TIME_TAKEN_DISPLAY HOURS END_TIME
------------- ----------------- -------------------- -------- ------------------------
3 2.03556203 00:00:18 .00 28-sep-14 11:03
6 7.81358269 00:00:25 .01 28-sep-14 11:06
14 10.7638918 00:00:19 .01 28-sep-14 11:07
The contents of V$RMAN_BACKUP_JOB_DETAILS are summarized by a session connection to RMAN. Therefore, the
report output is more accurate if you connect to RMAN (establishing a session) and then exit out of RMAN after the
backup job is complete. If you remain connected to RMAN while running multiple backup jobs, the query output
reports on all backup activity while connected (for that session).
You should have an automated method of detecting whether or not RMAN backups are running and if data files
are being backed up. One reliable method of automating such a task is to embed SQL into a shell script and then run
the script on a periodic basis from a scheduling utility such as cron .
I typically run two basic types of checks regarding the RMAN backups:
Have the RMAN backups run recently?
Are there any data files that have not been backed up recently?
The following shell script checks for these conditions. You'll need to modify the script and provide it with a
username and password for a user that can query the data dictionary objects referenced in the script and also change
the e-mail address of where messages are sent. When running the script, you'll need to pass in two variables: the
Oracle SID and the threshold number of past days that you want to check for the last time the backups ran or for when
a data file was backed up.
#!/bin/bash
#
if [ $# -ne 2 ]; then
echo "Usage: $0 SID threshold"
exit 1
fi
# source oracle OS variables
export ORACLE_SID=O12C
export ORACLE_HOME=/orahome/app/oracle/product/12.1.0.1/db_1
export PATH=$PATH:$ORACLE_HOME/bin
crit_var=$(sqlplus -s <<EOF
/ as sysdba
SET HEAD OFF FEEDBACK OFF
SELECT COUNT(*) FROM
(SELECT (sysdate - MAX(end_time)) delta
FROM v\$rman_backup_job_details) a
WHERE a.delta > $2;
EOF)
#
if [ $crit_var -ne 0 ]; then
echo "rman backups not running on $1" | mailx -s "rman problem" dkuhn@gmail.com
Search WWH ::




Custom Search