Re: Change dbo
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Sat, 05 Apr 2008 03:51:46 -0700
GoodwinM (mitchgoodwin@xxxxxxxxxxx) writes:
I am not a SQL kind of person, but sure hope someone here is:
I have a database where a user is defined as the dbo on a database. I do
not want this user defined as such. I assume this was generated during
creation of the database.
Is there a way to remove this user from being dbo on a database, or
changing the dbo schema to another user? I tried using SQL Server Manger
and just unchecking the box, but of course this fails.
Permit me to first some terminology straight. In SQL Server we talk
about server *logins* and database *users*. In a database, the login is
mapped to a database user. In many cases, the name of the user is the
same as the name of the login, but it does not have to be that way.
And there is one important exception: the owner of the database always
map to the user dbo, and so does members of the sysadmin server role.
So strictly speaking, your question is contracdictive. The user dbo is
dbo by definition, and this cannot be changed. But apparently that is
not what you are asking. My little problem is that I have to guess a bit,
as there are two possible interpretations of what you are really asking
for:
1) The login for this person maps to dbo.
2) The login for this person does not map to dbo, but the login has
db_owner rights in the database.
In the first case, this could be because that the login is the owner of
the database. In this case change.
ALTER AUTHORIZATION ON DATABASE::thisdb TO someoneelse
You may then need to map this login to a new user in the database, so
that this person still have access to the database.
It may also be because the login is a member of the sysadmin role, in
which case you should drop him from that role with sp_dropserverrolemember.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Follow-Ups:
- Re: Change dbo
- From: GoodwinM
- Re: Change dbo
- References:
- Change dbo
- From: GoodwinM
- Change dbo
- Prev by Date: Re: Change dbo
- Next by Date: Re: Change dbo
- Previous by thread: Re: Change dbo
- Next by thread: Re: Change dbo
- Index(es):
Relevant Pages
|
|