How to enable online restore

When a general restore is done, the database is offline. How do we make the restore as online enabled, so the database can be up while the restore is happening?

Who is Participating?
gothamiteConnect With a Mentor Commented:
If I have understood you correctly, you want to know how to access the database while the actual restore operation is in process. This is not always possible and depends on quite a lot....

You have two basic options for accessing data while a restore is in progress

1) You can perform a piecemeal restore (See this MSDN page for full details: This is applicable only if your database is split into multiple filegroups. Using this method, you can access data in whichever filegroup isn't currently being restored.

2) If this is part of a DR setup, you could consider using database mirroring to create a replica of the database on another server. Although the database won't be accessible directly you can create a snapshot of it, which will be accessible (but obviously read-only)

Hope that helps,
Raja Jegan RConnect With a Mentor SQL Server DBA & ArchitectCommented:
If your database is offline, just make it online using this command..

use master

If I haven't understood your question, then kindly explain more on this.
anushahannaAuthor Commented:
I am referring to feature #2 in
Is piecemeal the same as 'Online Restore'?
gothamiteConnect With a Mentor Commented:
Yes. I know - I got all excited the first time I read that as well. But when it says "only the data being restored is unavailable" it in fact means "all of the data in the filegroup that is currently being restored is unavailable". I think they should change the wording personally.

Also piecemeal restores don't work for the PRIMARY filegroup - i.e. this filegroup is always offline during a restore. I think that's because it contains some system objects or something, so you would have to split your objects out into new filegroups to make this work.
anushahannaAuthor Commented:
Thanks. So it is a not a very practical option- especially if the DB is small enough that there is no need for multiple filegroups.
All Courses

From novice to tech pro — start learning today.