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)
 Restoring DB

Author  Topic 

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2007-10-31 : 17:15:29
I am looking to create a new DB from a backup here's the code

RESTORE DATABASE SpProductionDBBak
FROM DISK = 'C:\DellSqlBackup\SpProducitonDb10-29-2007.bak'
WITH
REPLACE,
NORECOVERY, -- Use if more T/Logs to recover
-- RECOVERY, -- Use if NO more T/Logs to recover
-- STATS = 10 -- Show progress (every 10%)
MOVE 'SpProductionDBNew_Data' TO 'C:\Program Files\Microsoft SQL Server\DataFiles\SpProductionDBBak.mdf',
MOVE 'SpProductionDBNew_Log' TO 'C:\Program Files\Microsoft SQL Server\DataFiles\SpProductionDBBak_Log.ldf'
GO

It tells me it successfully restored, but in SMS when I look at the Database in the object Explorer it says

SPProductionDBBak(Restoring...)

any thoughts?

is it possible that it's still working (20 minutes have passed)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-31 : 17:17:10
That's because you've specified the NORECOVERY option, which mean you want to keep restoring files.

If you are finished with restoring, then specify RECOVERY instead.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2007-11-01 : 00:24:44
That's it, thanks!
Go to Top of Page
   

- Advertisement -