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
 General SQL Server Forums
 New to SQL Server Administration
 RESTORE DOUBT

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2010-05-04 : 16:21:41
I've a full backup and a log backup. i'm setting up mirroring. can you give me the script to restore with norecovery ?
i'm missing at some where...

RESTORE DATABASE mydb FROM DISK = N'G:\Mirror_copy\mydb.bak'
RESTORE LOG mydb FROM DISK = N'G:\Mirror_copy\mydb.TRN' WITH NORECOVERY
GO

Arnav
Even you learn 1%, Learn it with 100% confidence.

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2010-05-04 : 16:28:57
Got it
RESTORE DATABASE mydb FROM DISK = N'G:\Mirror_copy\mydb.bak' WITH NORECOVERY ---i missed this WITH NORECOVERY
RESTORE LOG mydb FROM DISK = N'G:\Mirror_copy\mydb.TRN' WITH NORECOVERY


Arnav
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-04 : 16:30:32
You need to specify WITH NORECOVERY for the full backup too.

You may find this blog post useful: http://weblogs.sqlteam.com/tarad/archive/2007/02/13/60091.aspx

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

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-04 : 16:31:29
You beat me to it; I was looking up my blog link.

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

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-05 : 01:42:34
You can bring the database Live by restoring the final LOG backup using WITH RECOVERY or (something I didn't know for a long time, hence why I mention it ) you can just do:

RESTORE DATABASE MyDatabaseName WITH RECOVERY

without specifying any file to restore from
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-05 : 01:45:50
quote:
Originally posted by Kristen

You can bring the database Live by restoring the final LOG backup using WITH RECOVERY or (something I didn't know for a long time, hence why I mention it ) you can just do:

RESTORE DATABASE MyDatabaseName WITH RECOVERY

without specifying any file to restore from



You can even specify that command on the mirrored database after mirroring has been broken. We did this last week so that testing could be performed on the mirrored side. We were so happy that we didn't need to do backup/restore to get it available.

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

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-05 : 02:10:38
I was grandly assuming that would be the case, but I've never used a mirrored server ... so good to have it confirmed by someone who has. I'm working on a job at the moment which will have a warm-standby (you'll be hearing from me no doubt!!)
Go to Top of Page
   

- Advertisement -