Oracle database tips logo
Article categories | Blog and News Page | SQL | SQL*Plus | DBA Scripts | Standby dbs | Database Links | Techno webcasts | Oracle Magazine | Free IT Magazines | Oracle Database Hosting Companies | Site Search |
RSS
XML RSS
What is this?
AddThis Feed Button

Social Bookmarking


Free Linux Manuals !


A Newbie's Getting Started Guide to Linux



The GNU/Linux Advanced Administration
-- FREE --
IT Magazine
Subscriptions

Oracle Magazine Oracle Magazine Contains technology strategy articles, sample code, tips, Oracle and partner news, how-to articles for developers and DBAs

WebSite Magazine WebSite Magazine Practical advice, helpful tools and insights for website owners

Dr Dobb's Journal Dr Dobb's Journal enables coders to write the most efficient programs and help in daily programming quandaries

DM Review DM Review is recognized as the premier business intelligence, analytics and data warehousing publication
Various other Free IT magazine subscriptions
NoAdware Free Trial

NoAdware Remove
harmful
adware,
spyware,
trojans,
dialers
and worms!
- Featured ebook -

Database Normalization
by Alf Pedersen

Database Normalization ebook Understand and master how to normalize a database using methods richly documented with graphical ERD and server diagram examples

Oracle ftp script
Automate your file transfers.


Make sure you always test this oracle ftp script on a test server before implementing it
on a production system !
FTP stands for File Transfer Protocol.

If you are using a recent version of Linux, you should investigate scp as an alternative to FTP.

Below is a script to automate transferring files from one server to another.

In this case, we're ftp'ing archive log files from the standby server back to the production server. (prod.world.com)

The trick to this script is to make sure that all the files to be ftp'ed have a similar filename structure,
which is always the case with archive log files.

There are 2 examples.

The first one shows you how to ftp a range of filenames, the second one transfers all filenames in a directory.

Both scripts are saved as ftp_commands.txt.

To run it in the background (so that it does not get killed if your session gets disconnected),
you will need to be located in the directory where the archive log files are on the standby server
and you would run it as follows:
  nohup ftp -ivn prod.world.com < ftp_commands.txt &


You can check its progress by tailing nohup.out in the directory where you executed the command.

  tail -f nohup.out


First script:

(note how we transfer a range of files with mput, and the last single file with put).

Contents of ftp_commands.txt:

user oracle oraclepassword
binary
cd /logs/proddb/arch
prompt off
mput proddb_1_2514*.arc
mput proddb_1_2515*.arc
mput proddb_1_2516*.arc
mput proddb_1_2517*.arc
mput proddb_1_2518*.arc
mput proddb_1_2519*.arc
mput proddb_1_2520*.arc
put proddb_1_25210.arc
bye


Second script:

Contents of ftp_commands.txt:

user oracle oraclepassword
binary
cd /logs/prodb
prompt off
mput *.*
bye


top of page

Recommended reading:


  • Guide to Linux File Command Mastery
    An introduction to Linux commands.



  • Return from oracle ftp script back to oracle-script-tutorials.