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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restoring Databases

Status
Not open for further replies.

lachie

Programmer
Jun 12, 2001
25
AU

Hi, I'm writing an automatic database backup system for my company.

When I want to restore my database to the SQL Server I need to ensure that I have exlusive access to the database in question.

I have a way of retrieving the processes accessing the database (from the sysprocesses table in master). Does anyone have a better way of doing this? Ideally, I'd like to be able to open the database in "exclusive" mode (like you are able to do with a Jet database) but I'm not sure that this is possible.

The structure of the program is;

if CanOpenSQLExclusively then
Restore database
else
display a message to the user
endif
....


Thanks,

Lachlan



 

You can use sp_dboption to set the database in single user mode or in dbo use only mode. See SQL BOL for detailed info. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top