Veritas-bu

[Veritas-bu] Oracle Policy - Solution

2007-01-04 15:55:22
Subject: [Veritas-bu] Oracle Policy - Solution
From: ssesar at mitre.org (Steven L. Sesar)
Date: Thu, 04 Jan 2007 15:55:22 -0500
Curtis Preston wrote:
>
> I and a partner have done the same.  What we did was to run the wizard 
> multiple times with all the options we wanted, then compiled all the 
> results into one monolithic script.  The script gets the SID from the 
> policy name. 
>
>  
>
> I just think the wizard is a much better place to _/start/_ then the 
> example scripts.
>

LOL, unless you're a particularly stubborn and sadistic DP geek! You're 
right - when I first wrote this script of mine, I used one of the 
example scripts as my jumping off point. It's really not that difficult. 
In our case, we named our schedules <server>_<sid>_<hot|cold>, then 
built the basics off of:

# Set global variables
# -----------------------------------------------------------------

ORACLE_HOST=`echo $NB_ORA_PC_SCHED | awk -F_ '{print $1}'`
ORACLE_SID=`echo $NB_ORA_PC_SCHED | awk -F_ '{print $2}'`
ORACLE_BKUP_TYPE=`echo $NB_ORA_PC_SCHED | awk -F_ '{print $3}'`
export ORACLE_ASK=no
. oraenv
ORACLE_VER=`echo $ORACLE_HOME | awk -F/ '{print $NF}'`

RUNDATE=`/bin/date +"%m%d%y.%H%M%S"`
RMAN_LOG_FILE=/usr/openv/netbackup/logs/user_ops/dbext/oracle/$NB_ORA_PC_SCHED.$RUNDATE.log
TARGET_INIT_FILE=$ORACLE_HOME/dbs/init$ORACLE_SID.ora
TARGET_CONNECT_STR=/
TEMPLATE_OWNER=oracle
RUN_AS_USER=oracle
RMAN=rman
CUSER=`id | cut -d"(" -f2 | cut -d ")" -f1`
PAGE_EMAIL=oraadmin at mitre.org
TAG=$NB_ORA_PC_SCHED
BEGIN_TIME=`perl  -e 'print time'`

 From there, it's as easy as creating functions to bring down apps and 
sids, and functions which contain RMAN code.

The other BIG value-add to a script, such as this, is error reporting! 
In my script, if any of the functions fail, the script itself will exit 
with a non-zero status. This is particularly important to anyone looking 
at the activity monitor, in order to determine the status of an Oracle 
backup.

Left unmodified (ie, script created using the wizard), the status code 
that you see in the activity monitor for an Oracle backup is actually 
the exit status of the script, NOT the backup itself!

Beware!

--Steve

>  
>
>  
>
> ---
>
> W. Curtis Preston
>
> Author of O'Reilly's /Backup & Recovery/ and /Using SANs and NAS/
>
> VP Data Protection
>
> GlassHouse Technologies
>
>  
>
> ------------------------------------------------------------------------
>
> *From:* Steven L. Sesar [mailto:ssesar at mitre.org]
> *Sent:* Thursday, January 04, 2007 12:22 PM
> *To:* Curtis Preston
> *Cc:* Martin, Jonathan (Contractor); NB List Mail
> *Subject:* Re: [Veritas-bu] Oracle Policy - Solution
>
>  
>
> The one problem with the "wizard" architecture (at least, last that I 
> checked), is that one script needs to be maintained for each SID. Make 
> that two, if your backup strategy includes hot and cold backups. 
> Factor in potential differences in parallelism on databases which 
> reside on faster disk, versus those on slower disk, and you've got 
> even more scripts to maintain.
>
> My solution was to create a single, monolithic script, which, based on 
> input from the NBU schedule being run, determines whether or not it's 
> a hot or cold backup, if cold, shuts down the associated apps, shuts 
> down the SID, brings it up in startup mount mode (also cooked in some 
> logic to test to see if the database actually succeeded in shutting 
> down - after a period of time, a shutdown abort is issued), builds and 
> executes the RMAN code that I want and brings the SID/apps back up. 
> This way, I've got one script to manage, not 160+.
>
> --Steve
>
> Curtis Preston wrote:
>
> You said:
>  
>   
>> 4 - The default scripts are terrible, and while all this customization
>> is possible you really have to "dive in" and learn everything about how
>> RMAN and NBU communicate to make this happen. As far as I am concerned
>> RMAN telling NBU which policy and schedule to use should be STANDARD.
>>     
>  
> Are you talking about the example scripts, or the scripts produced by
> the wizard?  I think the scripts that are produced by the wizard are
> pretty good, and include the logic you're looking for.  It does a check
> for what type of schedule is running, then passes the appropriate
> variable to RMAN, last time I checked.  You'll have to edit it, of
> course, to get it to call the right one.
>  
> _______________________________________________
> Veritas-bu maillist  -  Veritas-bu at mailman.eng.auburn.edu 
> <mailto:Veritas-bu at mailman.eng.auburn.edu>
> http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
>   
>
>
>
>
> -- 
> ===================================
>  
>    Steven L. Sesar
>    Lead Operating Systems Programmer/Analyst
>    UNIX Application Services R101
>    The MITRE Corporation
>    202 Burlington Road - MS K101
>    Bedford, MA 01730
>    tel: (781) 271-7702
>    fax: (781) 271-2600
>    mobile: (617) 519-8933
>    email: ssesar at mitre.org <mailto:ssesar at mitre.org>
>  
> =================================== 


-- 
===================================

   Steven L. Sesar
   Lead Operating Systems Programmer/Analyst
   UNIX Application Services R101
   The MITRE Corporation
   202 Burlington Road - MS K101
   Bedford, MA 01730
   tel: (781) 271-7702
   fax: (781) 271-2600
   mobile: (617) 519-8933
   email: ssesar at mitre.org

=================================== 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://mailman.eng.auburn.edu/pipermail/veritas-bu/attachments/20070104/4c1f6629/attachment.html

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