Unfortunately there is no any direct way to restore database remotely from local backup file.
But the alternative solution is making a shared location in some where (local side or server side it's not matter) which both of the client and server have access to there.
(Update: Also, make sure the SQL server that will be performing the restore has permissions to the directory that you're copying the backup to. – @KSib)
Then restore the database from file :
- Copy
newDb.bak to \\serverip\$sharedfolder\newDb.bak on the
server.
RESTORE DATABASE YOURDB FROM DISK = N'\\serverip\$sharedfolder\newDb.bak';
if you want i can share the source code of restoring database in C#.
Update: Another solution is that create a table which contains varbinary column, Insert the backup file content from local to it by SqlCommand or SqlBulkCopy to and then export the file content to some where in your server by bcp such this:
BCP "SELECT FileContent FROM createdTable WHERE ID = 1000" queryout "C:\newDB.bak" -T
Then you can execute the restore command easily!
Also you can create a server side StoredProcedure containing a transaction to get the file content as input parameter and do all the command as one transaction.
I hope to be helpful for you :).