469,902 Members | 1,963 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

about restore

Now, I take over a application, one of the functionality is to restore database, but I find the original code, the original code puzzles me. To all user databases, for example, the restoring procedure of pubs database, is as follows:



1.

RESTORE DATABASE [pubs] FROM DISK = N'C:\backup\model.bak'

WITH FILE = 1, RECOVERY, REPLACE, KEEP_REPLICATION,

MOVE N'modeldev' TO N'C:\Program Files\Microsoft SQL Server\MSSQL\data\pubs_Playback.mdf',

MOVE N'modellog' TO N'C:\Program Files\Microsoft SQL Server\MSSQL\data\pubs_Playback.ldf'



2.

RESTORE DATABASE [pubs] FROM DISK = N'C:\backup\pubs.bak'

WITH STATS=10, FILE = 1, RECOVERY, REPLACE, KEEP_REPLICATION,

MOVE N'pubs' TO N'C:\Program Files\Microsoft SQL Server\MSSQL\data\pubs.mdf',

MOVE N'pubs_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL\data\pubs_log.ldf'





I donít understand what role the first SQL statement plays.

Or the original code has problem?
Sep 11 '07 #1
1 1092
rob313
16
If you are running these two statements right after one another with nothing in between, then I would say the first statement is useless. I'm not sure why you would recover a backup of the model database into the pubs database and then restore a backup of the pubs database into pubs. I notice it has the KEEP_REPLICATION setting on, but I don't see how that would alter things. Anyone else?
Sep 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by For example John Smith | last post: by
3 posts views Thread by butatista | last post: by
1 post views Thread by Jagdip Singh | last post: by
9 posts views Thread by GL | last post: by
11 posts views Thread by Chris | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.