On 5 Jun., 11:16, sat <vijji.em...@gm ail.comwrote:
Hi,
I'm working as a DB2 UDB DBA.
I have some questions regarding SCP command...
Actually every week redirect restore takes place from one of my
production servers to test servers..
So, but before i can restore it on the test server i need to transfer
the backup file from the production server... So i want use the SCP
command to do that... since it takes place on every wednesday early
morning i would like run the scp command using script...
If there is any chance for me, that i can do so please let me know
ASAP...
Its bit urgent for me....
*** The servers are in AIX environment***
maybe an AIX-group would be better then ?
of course you could use an autometed SCP to do so.
use crontab to start script to transfer and restore on test-server (or
if only want to start an scp-transfer, e.g. an one-liner, you can
directly in your crontab)
for scp you have to:
- generate ssh-key on prod-server for the user which will do the
transfer, use empty passphrase (otherwise you will be prompted for
passphrase every time you use scp)
- add public-part of key to "authorized_hos ts" on test-server
- do an ssh-login prod--->test (to answer fingerprint question)
this is only once neccessary
be warned: the empty-passphrase thing is an security issue! because it
allows ssh-login without pwd (from prod --test with this user), to
restrict it only to scp or only a specific scp-command it's a bit more
complicated (but feasible)
a sample-script could be:
-------------------------------------
ssh testsrv "rm ${BACKUPPATH}/*.001*" # remove last backupfile
from test
scp ${BACKUPPATH}/*.001* testsrv:${BACKU PPATH}/ # copy new
backupfile --test
ssh testsrv "/usr/local/dba/restore_DB.sh" # start restore script
on test