Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

determining database state 1

Status
Not open for further replies.
Nov 15, 2000
322
US
I have a DB that I have gotten a good backup of. This DB is used for training. I want to give the trainers the ability to restore the backup and effectively restore them to their pre class session state.

I've written an app that executes a restore command when they click a button. I want to make the app wait until the restore is done before returning a "It's done" message.

My problem is that I don't knwo how to determine if a database is in ready mode or still restoring.

I've found master..sysdatabases and it has a "status" column, but I don't know how to find the meaning of the number in this column, or if it's relevant.

Is there a stored proc that can be called to return database statuses? If not, can I join sysdatabases somewhere to get the status?

Monkeylizard
Sometimes just a few hours of trial and error debugging can save minutes of reading manuals.
 
Thank you. have a star!

Monkeylizard
Sometimes just a few hours of trial and error debugging can save minutes of reading manuals.
 
If the SQL command is still running then the restore is still running. Once the SQL command running then RESTORE DATABASE is complete the database is available.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top