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
 SQL Server Administration (2005)
 Restore database TO network server?

Author  Topic 

patshaw
Posting Yak Master

177 Posts

Posted - 2008-10-08 : 08:25:22
Hi,

I have server A and server B. Server A holds a full backup of a database that I want to restore to server B. Is it possible to script a restore that runs from server A and restores the backup file to create the new database on server B, effectively pushing the restore?

Thanks.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-08 : 08:29:09
Yes,There are 2-ways

1) you can restore directly from Serverb specifying \\ServerA\....(UNC)

2) Backup DB in server A and Copy it to Server B and Restore specifying local location .
Go to Top of Page

patshaw
Posting Yak Master

177 Posts

Posted - 2008-10-08 : 08:33:09
Hi Sodeep,

I think you misunderstand my question. I need to execute the script from server A which holds the backup file. This will restore the database to server B.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-08 : 08:36:55
What difference does it make? Try with above suggestion and you will be good.
Go to Top of Page

patshaw
Posting Yak Master

177 Posts

Posted - 2008-10-08 : 08:42:41
Can you give me an example of how the RESTORE DATABASE command would work using UNC please? I cannot see how this would avoid a restore of the database on server A.

Thanks.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-08 : 08:53:21
RESTORE DATABASE [Pat] FROM DISK = N'\\ServerA\DATAFILES\backupfiles'
WITH FILE = 1,
MOVE N'DB_Data' TO N'D:\data\Pat_data.mdf',
MOVE N'pat_Log' TO N'D:\data\pat_log.ldf', NOUNLOAD, STATS = 10
GO
Go to Top of Page

patshaw
Posting Yak Master

177 Posts

Posted - 2008-10-08 : 09:09:59
Perhaps I am missing something here Sodeep, forgive me if I am, but if I execute this from Server A I would expect the database to be restored on Server A, not on Server B as I require.
Go to Top of Page

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2008-10-08 : 14:09:40
Run sodeep's query with OSQL or SQLCMD connected to Server B.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-08 : 14:20:13
quote:
Originally posted by patshaw

Perhaps I am missing something here Sodeep, forgive me if I am, but if I execute this from Server A I would expect the database to be restored on Server A, not on Server B as I require.



You are making it complicated yourself.Just backup your database in ServerA and Copy the backup file to Server B and restore it in Server B.
Go to Top of Page

patshaw
Posting Yak Master

177 Posts

Posted - 2008-10-09 : 03:52:53
This is part of an automated process and I only have visibility of Server A. This is why I stated that the backup has to be performed from Server A and cannot be executed using Server B as it is not visible in the process. Anyway, I think I have found a way I can do this. Thanks for your help.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-09 : 08:21:47
quote:
Originally posted by patshaw

This is part of an automated process and I only have visibility of Server A. This is why I stated that the backup has to be performed from Server A and cannot be executed using Server B as it is not visible in the process. Anyway, I think I have found a way I can do this. Thanks for your help.



How can you restore into ServerB without visibility and necessary rights? Can we know how you solved the issue?
Go to Top of Page
   

- Advertisement -