cancel
Showing results for 
Search instead for 
Did you mean: 

bpstart_notify/bpend_notify Oracle ColdBackup

BarakatiA
Level 3

Dears,

 

Crontab file is used now in order to Start/Shutdown Oracle DB before  & after ColdBackup?

Where should I place bpstart&bpend script? what are the changes should be done on the script? is there any things needs to be done from Mster Server ?

 

your help is really appreciated.

Thanx in Advance

 

Regards,

Abdullah

1 ACCEPTED SOLUTION

Accepted Solutions

RiaanBadenhorst
Level 6
Partner    VIP    Accredited Certified

Hi,

 

You can use the exact same script you call from cron. Just rename the cron script that shuts down the DB bpstart_notify, place it in /usr/openv/netbackup/bin, and do the same for the cron script that starts up the DB. Renaming it to bpend_nofity. Alternitavely you can append .Policyname and even .schedulename to the file name of the scripts. This will have netbackup run it only for certain policies, or certain policies AND certain schedules.

 

If you dont append policy name to the bpstart_notify and bpend_notify (example bpstart_notify.OracleServer1 and bpend_notify.OracleServer1) it will run it each time any backup runs on the client (oracle server)

 

Nothing to be done on the master.

View solution in original post

14 REPLIES 14

RiaanBadenhorst
Level 6
Partner    VIP    Accredited Certified

Hi,

 

You can use the exact same script you call from cron. Just rename the cron script that shuts down the DB bpstart_notify, place it in /usr/openv/netbackup/bin, and do the same for the cron script that starts up the DB. Renaming it to bpend_nofity. Alternitavely you can append .Policyname and even .schedulename to the file name of the scripts. This will have netbackup run it only for certain policies, or certain policies AND certain schedules.

 

If you dont append policy name to the bpstart_notify and bpend_notify (example bpstart_notify.OracleServer1 and bpend_notify.OracleServer1) it will run it each time any backup runs on the client (oracle server)

 

Nothing to be done on the master.

BarakatiA
Level 3

Thanks for the fast response.

 

where exactly should I place DB shutdown script inside the bpstart.bat? do I need to add sleep line in order to give the DB time to completely shutdown before backup start?

 

Regards,

RiaanBadenhorst
Level 6
Partner    VIP    Accredited Certified

Hi,

 

There shouldn't be anything else in it, like I said, i can look exactly like the cron script. Unless you want to add something else that is.

 

NetBackup will wait for the script to execute/return for a default of 300 seconds. Once it exits it will continue with the backup. You can adjust this timeout value if required. Make sure you don't use any "&" in your script, then the backup wont start before the script has shutdown the DB.

BarakatiA
Level 3

Should I place it here after remove @REM ?

 

@REM --------------------------------------------------------------------
@REM main script starts here
@REM This is a simple script that records what kind of backup will be done along
@REM with other relevent information (Client name, policy name, etc) and
@REM appends the information to the results file
@REM --------------------------------------------------------------------

 

Regards,

Marianne
Level 6
Partner    VIP    Accredited Certified

If the crontab is running under oracle user name, you will probably need to add

su - oracle -c "
shutdown commands...
...... "

to the notify scripts.

Alternative option:

Add a User type schedule to the policy and remove the oracle path from the file selection.

Add a line similar to the following to the script executed by cron:

/usr/openv/netbackup/bin/bpbackup -p <policy-name> -s <user-schedule-name> -L </tmp/backup.out> </oracle-path>

RiaanBadenhorst
Level 6
Partner    VIP    Accredited Certified

Little confused, you're talking about cron which I know to be a unix/linux function, but you're list @REM examples, which according to me is Windows. Am i missing something, did windows get a cron feature while i wasnt looking?

 

Post your scripts that are called by cron so we can see.

BarakatiA
Level 3

Guys the follwoing is part from bpstart script "Find the attchemnt"

@REM --------------------------------------------------------------------
@REM main script starts here
@REM This is a simple script that records what kind of backup will be done along
@REM with other relevent information (Client name, policy name, etc) and
@REM appends the information to the results file
@REM --------------------------------------------------------------------

and crontab to shutdown/start DataBase like the follwoing

45 00 * * 5 /home/oracle/stopall.sh 1>/tmp/stopall.log 2>&1
30 06 * * 5 /home/oracle/startall.sh 1>/tmp/startall.log 2>&1

 

 

Marianne
Level 6
Partner    VIP    Accredited Certified

A Unix master have two sample bpstart scripts in /usr/openv/netbackup/bin/goodies:

bpstart_notify      bpstart_notify.bat

The .bat is meant for Windows clients and have all the @REM comments.

The one without the extention is the Unix/Linux sample and starts like this:

#! /bin/sh
# $Header: bpstart_notify.sh,v 1.4 2005/06/28 15:22:02 $
#
#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2010 Symantec Corporation, All Rights Reserved
$ *
#***************************************************************************
#ecpyrght
#
# bpstart_notify.sh
#
# This script is called by NetBackup when bpbkar is started up on the client
# to do a backup or archive.
#
# This script:
#       receives 4 parameters: CLIENTNAME POLICYNAME SCHEDNAME SCHEDTYPE
#       must be executable by the root user
#       should exit with 0 upon successful completion
#
# If this script will not complete within a few seconds, you should set
# the BPSTART_TIMEOUT in the /usr/openv/netbackup/bp.conf file on the server.

 

Please note the following must be run as oracle:

sqlplus "/ as sysdba" <<EOF
shutdown abort;
startup;
shutdown immediate;

(You need to check with your oracle team what the rest of the stopall script is doing and if it's necessary to add all of it in bpstart_notify.)

As you can see from the comments in the bpstart sample, this script is run as root. So, you will need to do something like the following:

su - oracle -c "
sqlplus "/ as sysdba" <<EOF
shutdown abort;
startup;
shutdown immediate; "

You also need to ensure that the shutdown and startup completes within 5 minutes as this is the NBU timeout for start and end scripts. This timeout can be increased.

As I've stated previoulsly, you can also stay with your crontab and add bpbackup to the end of the stopall script.

NBU2010
Level 6

Hi Marianne,

I need to take hot backup of oracle db without issuing oracle db password. Below are the scripts i m working with.

------------------------------------------------------------------------------------------------------------------------------------------------------

# more bpstart_notify.D062XHRDEV
rm /oracle/controlfilebkp/cntrlbkp.*
su - oraj35 -c 'echo exit|sqlplus "/ as sysdba" @/usr/openv/netbackup/bin/startback.sql'
DAY=`date +%d%m%y_%H%M`
ORACLE_SID=J35
mv /oracle/controlfilebkp/cntrlbkp.ctl /oracle/controlfilebkp/cntrlbkp.START.$ORACLE_SID.$DAY.ctl


# more bpend_notify.D062XHRDEV
su - oraj35 -c 'echo exit|sqlplus "/ as sysdba" @/usr/openv/netbackup/bin/stopback.sql'
DAY=`date +%d-%m-%y_%H%M`
ORACLE_SID=J35
mv /oracle/controlfilebkp/cntrlbkp.ctl /oracle/controlfilebkp/cntrlbkp.END.$ORACLE_SID.$DAY.ctl


$ more startback.sql
set feedback off;
alter system archive log current;
alter database begin backup;
alter database backup controlfile to '/oracle/controlfilebkp/cntrlbkp.ctl' reuse;


$ more stopback.sql
set feedback off;
alter database end backup;
alter system archive log current;
alter database backup controlfile to '/oracle/controlfilebkp/cntrlbkp.ctl' reuse;

 ---------------------------------------------------------------------------------------------------------------------------------------------------

Thanks in Advance.

BarakatiA
Level 3

HI Marianne

I am using Windows as master server & there is no Script for bpstart_notify wothout .bat.

Need your help.

 

Regards,

Marianne
Level 6
Partner    VIP    Accredited Certified

I have attached  Unix notify scripts (I had to attach .txt to allow the attachments). Please note that it's not a requirement to use the samples provided by Symantec. The only requirement is that must be executable by root user and must complete within 5 minutes.

If you decide to use these, please ftp to your Unix/Linux client in ASCII mode (binary mode adds ^M characters to EOL and you will to do 'dos2unix' to get rid of them).

NBU2010
Level 6

Hi Marianne,

 

How about hot db backup.....i have given my scripts in above post.

 

Thanks.

Will_Restore
Level 6

Per response in your other post

https://www-secure.symantec.com/connect/forums/oracle-db-hot-backup-issue

you should be using Oracle RMAN for hot backup.

Marianne
Level 6
Partner    VIP    Accredited Certified

I agree with Nicolai's response to your post: https://www-secure.symantec.com/connect/forums/oracle-db-hot-backup-issue

Use RMAN.

Either use RMAN to backup to disk and then backup this disk backup with a normal filesystem backup, or even better, use RMAN with the NBU for Oracle agent.