I've developed an Android app that uses an online SQL Server database (hosting provider is: a2hosting.com).
In addition, there is a native Windows app that everyday at 12am backup some tables in a .bak
file in E:\
location (USB FLASH DRIVE location).
I want to make a scheduled cmd batch file to update the server database with the local database.
I am trying to use the restore command to do that, because I want to replace the previous online database with my new local database.
What I have try to do:
restoreTOdb.bat
file:
sqlcmd -S (myservername) -U (myusername) -P (mypassword) -i db.sql
pause
db.sql
file:
USE master;
GO
RESTORE DATABASE (mydbname)
FROM DISK = 'E:\filename.bak'
WITH FILE = 1, NOUNLOAD, REPLACE, NORECOVERY, STATS = 5;
GO
The connection to my SQL Server database is successful
This is the error that appears in cmd:
Changed database context to 'master'.
Msg 3201, Level 16, State 2, Server (server-name), Line 1
Cannot open backup device 'E:\filename.bak'.Operating system error 3(The system cannot find the path specified.).
Msg 3013, Level 16, State 1, Server (server-name), Line 1
RESTORE DATABASE is terminating abnormally.C:\Users\Manos\Desktop\DB CONNECTION>pause