Re: Database Owner

From: Michael (mminzloff_at_co.dutches.ny.co)
Date: 05/19/03


Date: Mon, 19 May 2003 10:40:54 -0400


Thanks Dan. Changing the owner with the changedbowner stored procedure
worked. I actually think I understand it now too.

Thanks again.

"Dan Guzman" <danguzman@nospam-earthlink.net> wrote in message
news:uVO#urnGDHA.2152@TK2MSFTNGP12.phx.gbl...
> > If our DBA is now the owner, shouldn't they be the only one with
> > owner rights? We are finding that the user who originally created the
> > database on the test server can run a stored procedure that can drop
> and
> > create tables even though there userid doesn't have rights to do so.
>
> This is because you have a mismatch between the owner recorded in
> sysdatabases and the 'dbo' entry in the sysusers table. After the
> restore, the sysusers table will still contain the original SID from the
> test server so the developer will be mapped to 'dbo' if they have a SQL
> Server login on the production server.
>
> You can use sp_changedbowner to change the owner as desired. For
> example:
>
> Use MyDatabase
> EXEC sp_changedbowner 'NewOwner'
> GO
>
> If you get message 'the proposed owner is already a user in the
> database', try:
>
> Use MyDatabase
> EXEC sp_addlogin 'TempOwner'
> EXEC sp_changedbowner 'TempOwner'
> EXEC sp_changedbowner 'NewOwner'
> EXEC sp_droplogin 'TempOwner'
> GO
>
> Note that you may have a similar issue with non-dbo database users as
> well. These can be reported/corrected with sp_change_users_login. See
> the Books Online for details.
>
> --
> Hope this helps.
>
> Dan Guzman
> SQL Server MVP
>
> -----------------------
> SQL FAQ links (courtesy Neil Pike):
>
> http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> http://www.sqlserverfaq.com
> http://www.mssqlserver.com/faq
> -----------------------
>
> "Michael" <mminzloff@co.dutches.ny.co> wrote in message
> news:udDr73hGDHA.1600@tk2msftngp13.phx.gbl...
> > We have been using a backup/restore procedure to copy databases from
> our
> > test server to our production server. We use the SQL Server backup
> utility
> > to backup the database on the test server and then use the restore
> utility
> > to put it down on the production server. In our situation, the user
> who is
> > the owner on the test server backs up the database and then our DBA
> does the
> > restore on the production server. This appears to make the DBA the
> owner on
> > the production server, but we are finding that the user who created
> the
> > database on test still seems to have owner privledges on the
> production
> > server. If our DBA is now the owner, shouldn't they be the only one
> with
> > owner rights? We are finding that the user who originally created the
> > database on the test server can run a stored procedure that can drop
> and
> > create tables even though there userid doesn't have rights to do so.
> >
> > Any comments would be appreciated.
> >
> >
>
>



Relevant Pages

  • Re: conflicting object names in sql server 2000
    ... The owner of the object will depend on the user ... On the local database server when it does the select * from ... she must specify the owner: ...
    (microsoft.public.sqlserver.server)
  • Re: Database Owner
    ... > owner rights? ... > database on the test server can run a stored procedure that can drop ... test server so the developer will be mapped to 'dbo' if they have a SQL ...
    (microsoft.public.sqlserver.security)
  • Re: conflicting object names in sql server 2000
    ... On the local database server when it does the select * from ... > michael.xxx Note that michael is the owner of the database. ... it will see if there is one owned by dbo. ...
    (microsoft.public.sqlserver.server)
  • Re: Database Security
    ... the rights to execute jobs with the proxy account. ... user at database level and not server. ... >>from 30 legacy systems) These often fail and the owner ...
    (microsoft.public.sqlserver.security)
  • Re: Replication failure
    ... Connecting to directory service on server arnelfs1. ... ARNELDC1 is the Schema Owner, but is not responding to DS ... prevented from starting by the File Replication Service. ...
    (microsoft.public.windows.server.active_directory)