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 2005 Forums
 Transact-SQL (2005)
 Backup to another server

Author  Topic 

kayo404
Starting Member

2 Posts

Posted - 2009-11-21 : 14:56:56
Hi,

I have connected 2 servers in Management Studio and using script to backup from one server to another server.
First using query on server1:
BACKUP DATABASE [F47999] TO DISK = N'\\server2\g$\x\F47999.bak' WITH NOFORMAT, NOINIT, NAME = N'F47999-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10

Next I use a query on server 2:
RESTORE DATABASE [F47999] FROM DISK = N'G:\x\F47999.bak' WITH FILE = 1, MOVE N'F47999Data' TO N'F:\MSSQL2\Visma\F47999.mdf', MOVE N'F47999Log' TO N'G:\MSSQL2\Visma\F47999_1.ldf', NORECOVERY, NOUNLOAD, STATS = 10


Is it possible to have this in one query?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-21 : 17:45:46
No, it takes two queries.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

kayo404
Starting Member

2 Posts

Posted - 2009-11-21 : 18:19:04
Ok, thanks for the answer.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-22 : 01:23:12
You're welcome.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -