- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help with script to FTP Oracle Archive files t...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 04:00 AM
тАО12-15-2003 04:00 AM
Help with script to FTP Oracle Archive files to another host
Attached you will find portion of the script and the missing part is of course the FTP. I am not sure of how to make it read each indivual line of the file resulting which contains the names of the files to be sent.
This script would run by cron, start one minute before change of hour, get the current hour value, and then sleep for a few seconds until the change of time to give enough time for generation of the last file in the current hour before it starts collecting the names of the all of the files for the current hour.
I hope I was able to explain my intent understandably.
Thanks gurus!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 04:06 AM
тАО12-15-2003 04:06 AM
Re: Help with script to FTP Oracle Archive files to another host
TARGET='target_sid'; export TARGET;
SOURCE='source_sid'; export SOURCE;
HOST='source_host';export HOST
USER='user';export USER
PASSWD="target_user_password";export PASSWD
ORACLE_SID=$TARGET;export ORACLE_SID
ftp_cd01=`echo cd /u01/oradata/$SOURCE/`;export ftp_cd01
ftp_lcd01=`echo lcd /u07/oradata/$TARGET`;export ftp_lcd01
ftp_cd02=`echo cd /u02/oradata/$SOURCE/`;export ftp_cd02
ftp_lcd02=`echo lcd /u02/oradata/$TARGET`;export ftp_lcd02
#FTP
ftp -i -n $HOST >ftp_log.out <
quote PASS $PASSWD
binary
hash
$ftp_lcd01
$ftp_cd01
mget *.*
$ftp_lcd02
$ftp_cd02
mget *.*
... etc
-Tomek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 04:07 AM
тАО12-15-2003 04:07 AM
Re: Help with script to FTP Oracle Archive files to another host
########################
ftp -nv ${SERVER} << FTPEOF > /tmp/temp_log.$$
user ${USERNAME} ${PASSWORD}
#Get file
get $1
quit
FTPEOF
braket variables must be set in advance. change get to put.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 04:08 AM
тАО12-15-2003 04:08 AM
Re: Help with script to FTP Oracle Archive files to another host
bye
EOF1
-Tomek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 04:26 AM
тАО12-15-2003 04:26 AM
Re: Help with script to FTP Oracle Archive files to another host
1. I can't simply use mput because I do not want to send all of the archives (unless I copied the specific archives to a directory that will contain only those and then do the mput from there, but I am trying to avoid doing that). I will only be sending a few at a time, depending on the hour of the day. Example:
The directory contains the following archives:
1025024 Dec 15 12:00 arch_1_2473506.arc
1025024 Dec 15 12:00 arch_1_2473505.arc
1025024 Dec 15 12:00 arch_1_2473504.arc
1025024 Dec 15 11:58 arch_1_2473503.arc
1025024 Dec 15 11:57 arch_1_2473502.arc
1025024 Dec 15 11:56 arch_1_2473501.arc
1025024 Dec 15 11:55 arch_1_2473500.arc
1025024 Dec 15 11:53 arch_1_2473499.arc
1025024 Dec 15 11:51 arch_1_2473498.arc
1025024 Dec 15 11:51 arch_1_2473497.arc
1025024 Dec 15 11:51 arch_1_2473496.arc
If the script starts running at 11:59, it will only put in the currenthrarchives.txt file files created between 11:00 and 11:59, the following:
arch_1_2473503.arc
arch_1_2473502.arc
arch_1_2473501.arc
arch_1_2473500.arc
arch_1_2473499.arc
arch_1_2473498.arc
arch_1_2473497.arc
arch_1_2473496.arc
Those are the only files to be sent. So I cannot use the following (which I have also used in some of mi scripts):
ftp -n ${HOST1} <<-EOF
user ${USER} ${PASS}
cd ${RMTARCHDIR}
binary
verbose
put $file
bye
EOF
Any other ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 04:35 AM
тАО12-15-2003 04:35 AM
Re: Help with script to FTP Oracle Archive files to another host
-Tomek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 04:52 AM
тАО12-15-2003 04:52 AM
Re: Help with script to FTP Oracle Archive files to another host
just in case, that rcp is also an option. I have attached a script, we use for transfering archive logs to a standby database. We zip the files, hence the extension .gz. At the remote location we try to unzip and recover the files into the standby database.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 05:24 AM
тАО12-15-2003 05:24 AM
Re: Help with script to FTP Oracle Archive files to another host
The script does collect the names of all of the files for the prescribed time, i.e.:
1. By cron it starts at the 59th minute of the hour, collects the current HR time (let's say it is 11:59, it gets 11 for the hour) and then sleeps for 90 seconds. This is to allot some time for a possible last file creating in that one last minute of the h hour.
2. After the 90 seconds sleep, it starts looking for all files which have a creation hour of 11, and places a list of all of the file names in an "txt" file.
Now, what I really need is to be able to FTP all of the files within that resulting "txt" file. That's where I am encountering a wall.
Like I said, I could avoid the issue by reading the file and creating a compressed copy of them into another directory before I do an mput, but what I am trying to avoid is to copy them within the same system at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 07:04 AM
тАО12-15-2003 07:04 AM
Re: Help with script to FTP Oracle Archive files to another host
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 09:01 AM
тАО12-15-2003 09:01 AM
Re: Help with script to FTP Oracle Archive files to another host
I dont understand, why you dont use compression on both sides. It has the advantage of reducing the amount to copy to the remote system considerably but also gives you the chance to do a little consistency check on the remote site.
So here my suggestion:
#!/bin/ksh
cd /path/to/archive
ls -l *.arc | awk '{printf("%12d %s\n",$5,$9)}' > loclist
ftp -n remhost << EOT
user ftpuser passwd
cd /path/to/archive
dir *.arc remlist.tmp
EOT
awk '{printf("%12d %s\n",$5,$9)}' remlist.tmp > remlist
echo
comm -23 loclist remlist | awk '{print "put "$2}' > ftp.bat
ftp -nv remhost << EOT
user ftpuser passwd
cd /path/to/archive
`cat ftp.bat`
EOT
rm loclist remlist remlist.tmp ftp.bat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 07:46 PM
тАО12-15-2003 07:46 PM
Re: Help with script to FTP Oracle Archive files to another host
It's an Oracle tool (free with 9i) which does just this for you.
http://otn.oracle.com/products/oracle9i/daily/mar25.html
- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2003 08:44 PM
тАО12-15-2003 08:44 PM
Re: Help with script to FTP Oracle Archive files to another host
TMPSH=/tmp/ftp$$
cat > $TMPSH << ++END++
ftp -n $HOST1 << EOF
user $USER $PASS
bin
cd $TARGETDIR
++END++
for VAR in ($cat ${THISHRARCHFILES})
do
echo put $VAR
done >> $TMPSH
echo "quit\nEOF" >> $TMPSH
sh $TMPSH
rm $TMPSH
Regards.