Skip to content

SCP files manually

July 1, 2013

To Manually SCP archive files to standby,if standby DB is lagging back and catching up slowly.
—————————————————————————————————————

Archive files List
———————-
Arch0001R0563793759S50200.ARC

Arch0001R0563793759S50210.ARC
Arch0001R0563793759S50211.ARC
….
….
Arch0001R0563793759S50219.ARC
Arch0001R0563793759S50220.ARC
Arch0001R0563793759S50221.ARC
…….
Arch0001R0563793759S50229.ARC
Arch0001R0563793759S50230.ARC
…..
Arch0001R0563793759S50299.ARC
Arch0001R0563793759S50300.ARC

1) Generate The scp commands for the first TEN archive files starting with ..210 till ..219 and save in scpfile.sh
———————————————————————————————————————

ls -ltr Arch0001R0563793759S5021[0-9]*.ARC|awk '{ print "scp "  $9 " solserv:/u30/oradata/HPCL/archive_logs/"}' > scpfile.sh

cat scpfile.sh
scp Arch0001R0563793759S50210.ARC solserv:/u30/oradata/HPCL/archive_logs/
scp Arch0001R0563793759S50211.ARC solserv:/u30/oradata/HPCL/archive_logs/

scp Arch0001R0563793759S50219.ARC solserv:/u30/oradata/HPCL/archive_logs/

execute
———-
nohup ksh -x scpfile.sh &

——————————————————————————-
2) If your Wild card search generates big file list,
in this case Arch0001R0563793759S502*.ARC it will generate 100 scp commands.
——————————————————————————-

ls -ltr Arch0001R0563793759S502*.ARC|awk '{ print "scp "  $9 " solserv:/u30/oradata/HPCL/archive_logs/"}' > scpfile.sh

cat scpfile.sh |wc -l
100

———————————————————————————————————————————
3)To transfer or scp 100 files in parallel, you need to spilt into 10 files with each file having 10 scp commands.
———————————————————————————————————————————-

split -l 10 scpfile.sh copyfile  [this would split file scpfile.sh and generate 10 files]

ls -ltrh copyfile*

copyfilea
copyfileb
copyfilec
..
..
copyfilej

4) Now run each file in background to scp files.
————————————————————
nohup ksh -x copyfilea &
jobs

Advertisements

From → Shell Scripts

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: