I have a task to clone two databases. I need to scp data files with 5 parallel sessions. This can be accomplished by using 'wait'.
The script looks like:
#!/bin/ksh
echo " tbs 1 starts `date` "
scp /v03/oradata/mydb/tbs34.dbf myserver01:/v03/oradata/mydb/ &
scp /v04/oradata/mydb/tbs05.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs06.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs07.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs08.dbf myserver01:/v04/oradata/mydb/ &
wait
echo " tbs 2 starts `date` "
scp /v04/oradata/mydb/tbs09.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs10.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs11.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs12.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs04.dbf myserver01:/v04/oradata/mydb/ &
wait
echo " tbs 3 starts `date` "
scp /v04/oradata/mydb/tbs17.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs26.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs27.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs28.dbf myserver01:/v04/oradata/mydb/ &
scp /v04/oradata/mydb/tbs16.dbf myserver01:/v04/oradata/mydb/ &
wait
--- truncated -------
In this script, five processes will be executed at background parallelly. The next five processes will start until all the previous background processes finish.
No comments:
Post a Comment