Link to home
Start Free TrialLog in
Avatar of nicolasn
nicolasn

asked on

How do I change the login for dbo?

I have a SQL2005 Express database (GAMDB) which I created using SQL Management Studio Express while logged in as a local administrator on the host system.  I am have SQL native authentication enabled.  I created an new login (gam), which is assigned and a new user (gamuser) belonging to a new role (gamsystem).  I have granted 'gamsystem' access to all the table in my database.

Now I would like to disable access by all Windows administrators on the host system (including myself), so that the SA is the boss, so to speak.  I have removed the BUILTIN\Administrators login from the sysadmin server role.  My problem is that the database user 'dbo' is associated with my login on the host system, and since dbo is the owner for the database, I still have access to do what I want with the database when logged in using Windows authentication.

If my understanding is correct, then what I am trying to do is the change the 'dbo' database user so that is is not associated with my Windows login any more, but rather with the 'sa' native login.

Any suggestions (besides that it is recommended to disable SQL native authentication!)

Thanks,

Nicolas
ASKER CERTIFIED SOLUTION
Avatar of gpompe
gpompe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nicolasn
nicolasn

ASKER

Wow, so simple:

USE GAMDB
GO

EXEC sp_changedbowner 'sa', true
GO

Can I have my points back?!

Nicolas
gpompe,

1) I wanted to make the sa the owner, not 'gamuser'

2) The sa login wasn't a defined user for the database (only by being in the sysadmin server role), so I didn't need to remove it.

3) See my sql which did the trick.

Never the less, I give you the points for a pretty good pointer that would definitely helped if I hadn't found the answer myself at the same time as your post.

Thanks,
Nicolas