Tuesday, February 14, 2012

Database level lock

Hi,
How do I lock entire database? I want an exclusive lock on the db by a user
who is the dbo of that database only (not sa user).
Thanks,
TanmayaHmm, take a look at
ALTER DATABASE ...SET command along with SINGLE_USER | RESTRICTED_USER |
MULTI_USER
"Tanmaya Kulkarni" <tanmaya_kulkarni@.persistent.co.in> wrote in message
news:%23bdnwHstGHA.3264@.TK2MSFTNGP03.phx.gbl...
> Hi,
> How do I lock entire database? I want an exclusive lock on the db by a
> user who is the dbo of that database only (not sa user).
> Thanks,
> Tanmaya
>|||This is a multi-part message in MIME format.
--=_NextPart_000_09A5_01C6B68C.705E4220
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
If I understand you correctly, you could do the following to limit the =database to dbo (and sa) roles only.
ALTER DATABASE MyDatabase
SET RESTRICTED_USER
And then when finished, return to regular use.
ALTER DATABASE MyDatabase
SET MULTI_USER
-- Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous
"Tanmaya Kulkarni" <tanmaya_kulkarni@.persistent.co.in> wrote in message =news:%23bdnwHstGHA.3264@.TK2MSFTNGP03.phx.gbl...
> Hi,
> > How do I lock entire database? I want an exclusive lock on the db by a =user > who is the dbo of that database only (not sa user).
> > Thanks,
> Tanmaya > >
--=_NextPart_000_09A5_01C6B68C.705E4220
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

If I understand you correctly, you =could do the following to limit the database to dbo (and sa) roles only.
ALTER DATABASE =MyDatabase
SET RESTRICTED_USER
And then when finished, return to =regular use.
ALTER DATABASE =MyDatabase
SET MULTI_USER
-- Arnie Rowland, =Ph.D.Westwood Consulting, Inc
Most good judgment comes from =experience. Most experience comes from bad judgment. - Anonymous
"Tanmaya Kulkarni" wrote in message news:%23bdnwHstGHA.3264@.TK2MSFTNGP03.phx.gbl...> Hi,> => How do I lock entire database? I want an exclusive lock on the db by a user => who is the dbo of that database only (not sa user).> > Thanks,> Tanmaya > >

--=_NextPart_000_09A5_01C6B68C.705E4220--

No comments:

Post a Comment