Re: Confused about dbo

From: Kalen Delaney (replies_at_public_newsgroups.com)
Date: 08/27/05


Date: Fri, 26 Aug 2005 18:59:46 -0700

Jasper

Make sure you understand the difference between login names and user names.
Please read about them in the Books Online.

A login name is how you get access to SQL Server. Your login name is then
mapped to a user name in a particular database, to give you access to that
database within a SQL Server instance.

There are several ways you could have the username dbo. One is if you are
the true owner of the database. Another way is if you are in the sysadmin
server role. From your description, it sounds like this is not the case, as
that would give you WAY too much power.

A third way to have the username dbo is that your login name might be
aliased to the username dbo, which means you are not the real owner, but
within the database, you have all the privileges of the owner. A user
aliased to the dbo cannot do things outside the db, like increasing its
size.

In addition to current_user, you can also do the following:

sp_helpdb <name of db>

This will tell you who is the true owner of the db. Also

SELECT suser_sname()

will tell you what your login name is.

HTH
Kalen Delaney
www.SolidQualityLearning.com

<Rene> wrote in message news:uFPwhTpqFHA.3604@tk2msftngp13.phx.gbl...
> Hey Japer:
>
> Well, I am away from the computer that has access to the database so I
> can't run the "select current_user" function right now, however, isn't me
> being the dbo a bad thing from the point of view of the hosting company?
>
> Wouldn't I be able to do things such as increase my database space or
> screw some other things up by me being a dbo? Especially since my database
> is on a shared SQL server?
>
> Thanks
>
>
> "Jasper Smith" <jasper_smith9@hotmail.com> wrote in message
> news:%23VFQqKpqFHA.3540@TK2MSFTNGP14.phx.gbl...
>> What does running the following in your database return
>>
>> select current_user
>>
>> It sounds like you are the database owner (your login has been mapped to
>> the dbo user in the database) since if you were simply a member of the
>> db_owner role you would indeed have to prefic objects with dbo when
>> creating them.
>>
>> --
>> HTH
>>
>> Jasper Smith (SQL Server MVP)
>> http://www.sqldbatips.com
>> I support PASS - the definitive, global
>> community for SQL Server professionals -
>> http://www.sqlpass.org
>>
>> "msnews.microsoft.com" <Rene> wrote in message
>> news:eDSuZ9oqFHA.3540@TK2MSFTNGP14.phx.gbl...
>>>I recently signed up with a web hosting company. The hosting package
>>>included a Microsoft SQL server database with it.
>>>
>>> Anyway here is my question. I know for sure that I am not the owner of
>>> the database (dbo) because hosting companies don't allow their customer
>>> to create their own databases, so why is it that when I create a table
>>> the owner of the table shows up as dbo? I would think that the owner
>>> should be my user name right?
>>>
>>> Why is this happening?
>>>
>>> Thanks for your help.
>>>
>>>
>>
>>
>
>



Relevant Pages

  • Re: Accidentally dropped DBO from database
    ... That error is due to having databases where the owner (dbo) ... is mapped to a login that doesn't exist on the server. ... a user in the database" when using sp_changedbowner, ...
    (microsoft.public.sqlserver.security)
  • Re: db_owner role in SQL 2k
    ... The owner of a database is a login, which is listed in the sysdatabases ... I try not to think of DBO as the Database Owner, but just as special, ... For anyone to use any database, their login name must have been given access ...
    (microsoft.public.sqlserver.programming)
  • Re: Login Name is missing
    ... Database ownership determines to login mapping for the 'dbo' user. ... > I see 'dbo' listed as the OWNER of all the tables. ...
    (microsoft.public.sqlserver.security)
  • Re: properties owner and users owner.
    ... 'dbo' is a special database user and must exist in every database. ... normally be the same login but can get out-of-sync in some situations, ... owner entries are synchronized: ...
    (microsoft.public.sqlserver.server)
  • Re: Who should I make the owner?
    ... Every login gets mapped to a username in every database they have access to. ... DBO is a special user name that exists in every database. ... NOT to think of DBO as meaning 'database owner' since many different logins ...
    (microsoft.public.windows.server.general)