Categories: Backup and RestoreFTP

Automating SFTP Downloads using WinScp Free Tool

Today’s article is about how to Automating SFTP Downloads using WinScp Free Tool:

This will be helpfull in many situations of which one is if you have your database hosted in Cloud by Hosted Services then for running reports etc. linking this database to another which is hosted locally, would mean you will need to automate SFTP downloads for that database and run restore script to Restore Database Automatically.

Procedure:

1. Install the WinScp Free Tool.
2. Access your FTP Site using SFTP(I used implicit FTP). If you cant access this then check your Firewall and see if this is blocked. Add exceptions to Firewall as needed.
3. Store a Session inside WinScp with Login and password credentials for Automating Downloads from FTP Site.


4. Run the above stored Session to see that it connects successfully.
5. Create a Schedule Task for Running a Program on Schedule as


"C:Program Files (x86)WinSCPWinSCP" /script=C:SQL-BackupBackupScript.txt


where “C:Program Files (x86)WinSCPWinSCP” is pointing to application
and /script=C:SQL-BackupBackupScript.txt is pointing to Script for Download as


option batch on
option confirm off
open xxx@pub.xxx.com
get /CloudDB_BackUp.bak C:SQL-Backup
exit
7. Run the task

8. The Backup should now be successfully downloaded to C:SQL-Backup folder.

Troubleshooting Tips:

If needed run the same script from CMD prompt.
First go to the location of program
cd C:Program Files (x86)WinSCPWinSCP

next run the Script
WinSCP /script=C:SQL-BackupBackupScript.txt

Vamshi B

Share
Published by
Vamshi B

Recent Posts

sql server detected logical consistency based error

Learn about SQL Server detecting logical consistency based issues and how to resolve them.

5 months ago

sql server error 1222

Learn about SQL Server error 1222 and how to resolve the lock request time out…

5 months ago

Microsoft SQL Server 2022 New Features

Discover the new features of Microsoft SQL Server 2022 and how they compare to previous…

5 months ago

SQL Server Error 1222 lock request time out period exceeded

SQL Server Error 1222 lock request time out period exceeded   Lock request time out…

5 months ago

SQL Server Error : 427, Severity: 20. Could not load the definition for constr

SQL Server Error : 427, Severity: 20. Could not load the definition for constraint ID…

10 months ago

SQL Server Error : 204, Severity: 20. Normalization error in node %ls.

SQL Server Error : 204, Severity: 20. Normalization error in node %ls.

10 months ago

This website uses cookies.