Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Database Backup to Linked Server

$
0
0
Hi,

I have a linked server and every operation such as Select, Insert and Update works perfectly on the Linked Server. 
I tried to take a backup from one server and to restore at another server say, MyServer. If I try to restore the database as this,
RESTORE 
	DATABASE MyServer.AdventureWorks
 FROM  DISK = N''C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\AdventureWorks.bak'' 
WITH  
	FILE = 1,  
	NOUNLOAD,  
	REPLACE,  
	STATS = 10
This shows the following error,
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '.'.
Msg 319, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

I tried to use this statement instead,

EXEC('RESTORE 
	DATABASE [AdventureWorks] 
 FROM  DISK = N''C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\AdventureWorks.bak'' 
WITH  
	FILE = 1,  
	NOUNLOAD,  
	REPLACE,  
	STATS = 10')
AT MyServer
However the above script works fine, but the problem is that my backup should be exists at the Linked Server, Since the AT is looking for a file at MyServer.  Can any one give me suggestions or alterations for this.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>