all groups > sql server programming > september 2006 >
You're in the

sql server programming

group:

Lock and unlock a database


RE: Lock and unlock a database ML
9/13/2006 6:55:02 AM
sql server programming:
Look up SINGLE_USER under ALTER DATABASE in Books Online.

E.g.:

alter database <db>
set single_user
with rollback immediate
go

Don't try this until you've read the article in Books Online!


ML

---
Lock and unlock a database Man-wai Chang
9/13/2006 9:42:23 PM

I would like to lock a database for exclusive access by one connection,
perform a download and off-server backup, and then unlock it to allow
users to continue their work. How could I lock and unlock the db?

--
.~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06) Linux 2.6.17.13
^ ^ 21:41:01 up 4 days 2:35 0 users load average: 1.09 1.05 1.01
Re: Lock and unlock a database Man-wai Chang
9/15/2006 12:00:00 AM
[quoted text, click to view]

Thanks. I won't use "with rollback immediate".


--
Man-wai Chang
Softmedia Technology Co., Ltd.
AddThis Social Bookmark Button