Networker

Re: [Networker] How to create multiple log files for RMAN backups?

2006-12-06 13:04:19
Subject: Re: [Networker] How to create multiple log files for RMAN backups?
From: Will Parsons <w.parsons AT LEEDS.AC DOT UK>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Wed, 6 Dec 2006 18:03:30 +0000
Hi George,

Here's one I made earlier ;-)

You can set the NSR_RMAN_OUTPUT variable to any name, so in your case (and mine in fact) using this might be better:

LOG=/var/tmp/`basename $0`_`date +%d%m%Y_%H%M%S`

To get the full output e-mailed out for failures, you'll need to create /nsr/debug/NO_SUPPRESS on the Networker server.

Don't forget to clean up after yourself in /var/log every once in a while.

Enjoy.
Will



/usr/sbin/nsrnmo

<SNIP>
#
# Optional Variable: NSR_RMAN_OUTPUT
#
# Default value: NONE (site specific)
#
# Description: Provide option to capture the RMAN standard output
# if RMAN "msglog" or "log" command line option is not set.
# The connect strings will be hidden in this file.
#
# Samples:
#       NSR_RMAN_OUTPUT="/nsr/applogs/msglog.log append"
#
#       NSR_RMAN_OUTPUT="/nsr/applogs/msglog.log"
#
# NSR_RMAN_OUTPUT="/nsr/applogs/msglog.log append"
LOG=/var/tmp/`basename $0`_$$.log
NSR_RMAN_OUTPUT="${LOG}"

<SNIP>

#
# Call nsrnmostart to do the backups.
#

# "print" doesn't exist..
# print $BACKUP_COMMAND_LINE
eval ${BACKUP_COMMAND_LINE} &
Pid=$!
wait $Pid

nsrnmostart_status=$?
if [ $nsrnmostart_status != 0 ] ; then
       echo "nsrnmostart returned status of "$nsrnmostart_status
       echo  $0 "exiting."
       cat "${LOG}"
       rm "${LOG}"
       exit 1
fi

# cat "${LOG}"
# rm "${LOG}"
##### Compress the log file, rather than deleting it.
compress "${LOG}"

exit 0
# End of script






George Sinclair wrote:
Hi,

We want to be able to create a unique log file every time we run an Oracle backup. Currently, we just end up with a new log file that overwrites the previous one, or we end up always appending. We'd like instead to somehow have the newly created log file get renamed to, say, logfilename.date or something like that. That way, we have one from each day. I can write a shell script to rename the file, but I need some way to have the shell script get run after the backups have completed. I'd prefer this over just having some cron job do it. This way I know the Oracle backups are done.

We're running 7.2.2 and backing up an Oracle database using the NMO. Client runs 7.2.2. Currently, we have an NSR client resource that specifies the pathname for the RMAN script as the saveset (just one), and it has 'nsrnmo' under the backup command field. I was reading about savepnpc, but we have nsrnmo listed for the field value because this is what the docs said to do, so I don't see how savepnpc will help us here.

In taking a look at the nsrnmo script, I see this:

# Optional Variable: PRECMD
#
# Default value: NONE
#
# Description: This variable can be used to run a command or command script # before nsrnmostart. It will be launched once for every saveset
#                               entered in the client setup.
#
PRECMD=

# Optional Variable: POSTCMD
#
# Default value: NONE
#
# Description: This variable can be used to run a command or command script # after nsrnmostart has completed. It will be launched once for # every saveset entered in the client setup.
#
POSTCMD=

I could create a shell script and list it for the PRECMD variable and have it first rename the current log, or I could use the POSTCMD, and do it after, but the thing that bothers me is where they say that it will be launched once for every saveset. Does this mean if we have just the one RMAN script listed for the client then it will only get run one time? OR, if the RMAM backup script produces, say, 5 save sets then it would get run 5 times? We're never going to generate less than 2 save sets based on the filesperset value in the RMAN script and the number of files in our database. I'd say we would have no fewer than 5 savesets from a backup and maybe a lot more if it's a full. How do I solve this?

Thanks for any help

George





--


w.parsons AT leeds.ac DOT uk
UNIX Support
Information Systems Services
The University of Leeds
+44 113 343 5670

To sign off this list, send email to listserv AT listserv.temple DOT edu and type 
"signoff networker" in the body of the email. Please write to networker-request 
AT listserv.temple DOT edu if you have any problems with this list. You can access the 
archives at http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

<Prev in Thread] Current Thread [Next in Thread>