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
 SQL Server Administration (2000)
 Restoring databases ???

Author  Topic 

naegelbe
Starting Member

2 Posts

Posted - 2006-05-12 : 04:46:00
Hello

I need to synchronise 2 SQL Server databases from 2 independant network.

So I make first A backup for each user databases and in second, I need to make an automatic restore from backup files (*.bak).
How can I do this ?
Is there available scripts to do this ?

Thanks a lot.

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-12 : 05:00:20
look at restore database in bol.

This will do it for you
http://www.nigelrivett.net/SQLAdmin/s_TestRestore.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

naegelbe
Starting Member

2 Posts

Posted - 2006-05-12 : 05:36:19
Thanks a lot.
I will try this.
Go to Top of Page

DMcCallie
Yak Posting Veteran

62 Posts

Posted - 2006-05-12 : 10:50:09
Here you go: This does a DB disk backup then restores the DB backup over a different DB:

/* Backup Grouping DB to Disk 5/04/06 TDM */

BACKUP DATABASE [Grouping]
TO DISK = N'E:\Program Files\Microsoft SQL Server\MSSQL\Database Backups\Grouping.bak'
WITH NOFORMAT,
INIT,
NAME = N'Grouping Database Backup',
SKIP,
NOREWIND,
NOUNLOAD,
STATS = 10
GO

/* Restore Grouping DB Backup to Migration */

RESTORE DATABASE [Migration]
FROM DISK = N'E:\Program Files\Microsoft SQL Server\MSSQL\Database Backups\Grouping.bak'
WITH FILE = 1,
MOVE N'Grouping_Data' TO N'E:\Program Files\Microsoft SQL Server\MSSQL\data\Migration_Data.mdf',
MOVE N'Grouping_Log' TO N'F:\Program Files\Microsoft SQL Server\MSSQL\data\Migration_log.ldf',
NOUNLOAD,
REPLACE,
STATS = 10
GO
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-05-12 : 12:25:39
Just in case the hard-wired names in that example, in particular the logical names in the MOVE statement, fox you then have a look at the syntax example:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=RESTORE%20syntax%20/%20example,Restore

Kristen
Go to Top of Page

DMcCallie
Yak Posting Veteran

62 Posts

Posted - 2006-05-12 : 15:40:17
Yes in my example the names are explicitly defined; however, I was just showing an example of a working backup and restore command syntax...DeWayne
Go to Top of Page
   

- Advertisement -