1823920 Members
3169 Online
109667 Solutions
New Discussion юеВ

rsync in batch mode

 
Prashant Zanwar_4
Respected Contributor

rsync in batch mode

Just wanted to consult if some one has tried rsync in batch mode, I need to sync oracle code trees...Please let me know...
Thanks and regards
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
8 REPLIES 8
Geoff Wild
Honored Contributor

Re: rsync in batch mode

Batch mode? not to sure what you mean.

I use rdist to sync from cron for DR reasons.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Prashant Zanwar_4
Respected Contributor

Re: rsync in batch mode

I am trying it..

Thanks and regards
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Geoff Wild
Honored Contributor

Re: rsync in batch mode

rdist - cool - here's how I do it:

From cron:

# Copy prdadm across to the DR site.
05 01 * * * /app/admin/drp/update-binaries.sh >/dev/null 2>&1

# cat /app/admin/drp/update-binaries.sh
#! /bin/sh

# Keep the DRP copy of the prdadm up-to-date.
# Currently the files are in:
#
# /home/prdadm/DR
#
# See the rdist(1M) distfile for a list of exclusions.

TERM=xterm
DRPDIR=/app/admin/drp
DRPHOST=svr031

HOST=`/usr/bin/uname -n`
PRD=`cmviewcl |grep prddbci |awk '{print $5}'`
if [ "$HOST" = "$IPR" ]
then
mount | grep /home > /dev/null 2>&1
if [ $? -eq 0 ]
then
( su - prdadm -c "rdist -f $DRPDIR/distfile ipradm"; ) 2>&1 |\
tee $DRPDIR/drp.log 2>&1 |\
mailx -s "prdadm DRP rdist output" `cat /usr/local/mailadmin.list`
fi
fi


# cat distfile
PRDDR = ( svr031 )

#
# File systems to be copied over to the DR host.
# Don't use -R in install - so as not to remove files on destination host
PRDADM = /home/prdadm

prdadm: ( ${PRDADM} ) -> ( ${PRDDR} )
install -w ;


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Patrick Wallek
Honored Contributor

Re: rsync in batch mode

I'm not sure what you mean by batch mode, but here is an rsync that I run nightly:

/usr/local/bin/rsync -avcu --delete --stats --rsync-path=/usr/local/bin/rsync hquwh50:/mesave1/ /sync/mesave1/


I use the same basic command to sync several directories from several systems nightly. It works great!
TwoProc
Honored Contributor

Re: rsync in batch mode

rsync commands for oracle - let's say an ORACLE_HOME on one machine to another...

assuming rsync and cron job (thus full paths)
assuming cron job runs on "receiving machine" from the rsync...

/usr/bin/rsync -avze ssh --delete source_machine:/a1/oracle/OHOME/ /a1/oracle/OHOME/

notes -
a) leave off the "--delete" switch if you only want to update new or changed files - but not get rid of deleted files from the source machine.
b) if you're not using ssh - it's more like
"rsync -avz" instead of "rsync -avze ssh"
c) leave of the "z" switch if you don't want on the fly compression.
d) *trailing /'s* are VERY IMPORTANT - if you are cloning one whole dir to another use the above - if you want options - play around with leaving off the trailing "/" on either the source or dest to see what happens -- it makes a big difference.

We are the people our parents warned us about --Jimmy Buffett
Daryl Much
Frequent Advisor

Re: rsync in batch mode

If rsyncing $ORACLE_HOME (and/or $ORACLE_BASE) you might want to consider the following excludes:

--exclude ${VER}/network/admin
--exclude oracle/admin/${SID}/*dump
--exclude ${VER}/network/log

The 1st one is very important as that's where listener.ora and tnsnames.ora files live. You might accidentally stop the listener on the rsync source node if you don't preserve the local settings on the rsync destination. Been there, done that...

BTW, I use rsync from cron each hour to sync our DR node. I use ssh and have established authorized key files. Works very well.

HTH,

Chuck Davis
Prashant Zanwar_4
Respected Contributor

Re: rsync in batch mode

The version which is there with Liniux and 11iv2 hosts supports this..
It has option like

--write-batch=, which creates file starting with prfx.rsync_*..it creates a data file containing the information on copy, which can be taken to any host and then execute the shell provided by rsync run..
Hope this helps.
Thanks and regards
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Prashant Zanwar_4
Respected Contributor

Re: rsync in batch mode

thanks
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."