Using Reverse CT to execute scp, the solution for transferring incomplete files is expectscp.

Source: Internet
Author: User

Using Reverse CT to execute scp, the solution for transferring incomplete files is expectscp.

Write a script to transfer files, similar to the following:

sendsystem(){expect -c "           spawn scp $ORACLE_BASE/oradata/$ORACLE_SID/system01.dbf oracle@$S_IP:$ORACLE_BASE/oradata/standby/           expect {               yes/no { send \"yes\r\"; exp_continue }               *assword* { send \"oracle\r\" }           };           expect 100%           expect eof ;       "}sendsysaux(){expect -c "           spawn scp $ORACLE_BASE/oradata/$ORACLE_SID/sysaux01.dbf oracle@$S_IP:$ORACLE_BASE/oradata/standby/           expect {               yes/no { send \"yes\r\"; exp_continue }               *assword* { send \"oracle\r\" }           };           expect 100%           expect eof ;       "}

Result:

spawn scp /home/oracle/std_control01.ctl oracle@192.168.134.134:/oracle/oradata/standby/std_control01.ctloracle@192.168.134.134's password: std_control01.ctl                                                                               100% 9520KB   9.3MB/s   00:00    spawn scp /oracle/oradata/orcl/system01.dbf oracle@192.168.134.134:/oracle/oradata/standby/oracle@192.168.134.134's password: system01.dbf                                                                                     92%  646MB  33.9MB/s   00:01 ETAspawn scp /oracle/oradata/orcl/sysaux01.dbf oracle@192.168.134.134:/oracle/oradata/standby/oracle@192.168.134.134's password: sysaux01.dbf                                                                                    100%  600MB  31.6MB/s   00:19    spawn scp /oracle/oradata/orcl/temp01.dbf oracle@192.168.134.134:/oracle/oradata/standby/oracle@192.168.134.134's password: temp01.dbf                                                                                      100%  200MB  66.7MB/s   00:03    spawn scp /oracle/oradata/orcl/undotbs01.dbf oracle@192.168.134.134:/oracle/oradata/standby/oracle@192.168.134.134's password: undotbs01.dbf                                                                                   100%  200MB  40.0MB/s   00:05 

System01.dbf will not be passed after it is passed.
I tried several times and found that other files could not be uploaded.

The final result is that the default timeout value of CT is 30 S.
Manually add set timeout-1 to set the timeout value to infinity. The problem is solved.

sendsystem(){expect -c "           set timeout -1           spawn scp $ORACLE_BASE/oradata/$ORACLE_SID/system01.dbf oracle@$S_IP:$ORACLE_BASE/oradata/standby/           expect {               yes/no { send \"yes\r\"; exp_continue }               *assword* { send \"oracle\r\" }           };           expect 100%           expect eof ;       "}

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger. Red and black alliance, linux community stealing and turning to dead mom

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.