Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    369

    Unanswered: automated export and ftp files script?

    Perhaps the Unix script gurus can help me out. We want to export about 15 tables from our production database server over to our test database server (separate machine) using export and ftp. Any tips besides replication on how to do this? Here is a sample:

    Database Server A:

    #!/bin/ksh
    db2 "export to /staging/info.del of del select * from info";

    Database Server B:

    script would need to connect to Database Server A and grab the files using ftp.

    Thanks!

    Scott

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: automated export and ftp files script?

    See if this helps :

    HOST='host1'
    USER='user1'
    PASSWD='password'
    FILES='file1 file2 file3 file4'

    for FILE in $FILES
    do
    ftp -n $HOST <<END_SCRIPT
    quote USER $USER
    quote PASS $PASSWD
    prompt
    lcd /staging/exported
    cd /staging/ftp
    put $FILE
    quit
    END_SCRIPT

    echo "Processed " $FILE

    done

    exit 0

    Rather than transferring multiple fies, you can cosider tarring and compressing the exported files and then ftp ... Remember to use binary mode then ..

    It is better to use put in your case, as you will need to expose the password and it may not hurt much to expose the test server's password ..

    HTH

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    May 2003
    Posts
    369

    Thanks!

    As always Sathyam thanks for the help. I will customize it and do some testing. Until I can get replication setup this will do fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •