Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Restoring DB on a Remote Server

Author  Topic 

Mmats
Starting Member

47 Posts

Posted - 2005-07-20 : 09:32:50
I am trying to find a way to do a query on a remote server to restore a database. Here is what I am currently trying:

SELECT * FROM OPENROWSET('SQLOLEDB','192.168.1.200';'sa';'sa',
'RESTORE DATABASE Test FROM DISK = "e:\program files\mssql\backup\db backups\database.BAK"')

It gives me this error:

Server: Msg 8180, Level 16, State 1, Line 1
Statement(s) could not be prepared.
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'e:\program files\mssql\backup\db backups\database.BAK'.
[OLE/DB provider returned message: Deferred prepare could not be completed.]


The reason I went with openrowset is because I dont want to add a linked server and I need to do this remotely on a regular basis. The filepath to the database is the correct path on the remote server. Is there a SP that comes in sql that can do a database restore? Running w2k server, sql2000.

Kristen
Test

22859 Posts

Posted - 2005-07-20 : 13:27:50
c.f. http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=52603
Go to Top of Page
   

- Advertisement -