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).

The

scenario is we have a web application and each week we need to do data

uploads (with etl). During this upload, the users accessing the website

should not be able to read data. This is why I want database lock.

Now

the catch here is, the application access the data using user say abc.

Abc is dbo for that database and the etl is also done by abc login. So

will db locking help in this case as the website can also read the data

being a abc user?

Thanks,
Tanmaya

You can use sp_dboption system stored procedure to put database in dbo use mode.

dbo use only

When true, only the database owner can use the database.

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/92d4714b-95bf-46af-b05e-759a7164f937.htm

Thanks,

Deepak Kumar

|||You can use the ALTER DATABASE Name SET RESTRICTED_USER command to switch the database to administrative mode.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment