Solved

Change Database Owner

Posted on 2013-11-07
5
383 Views
Last Modified: 2013-11-13
I recently upgraded from SQL Server 2000 to SQL Server 2008.  To do this, I created new databases in 2008, then restored the 2000 bak file to the 2008 database.  All seems to be working just fine for about a week now.  

I need to change the length of a varchar field from 50 to 200 characters.  Should be simple enough.  However, I'm getting a message stating that the change can't be made because there is no owner assigned to the database.  I've tried changing the owner using:

exec sp_changedbowner 'netadmin'

I am getting this message:
Msg 15110, Level 16, State 1, Line 1
The proposed new database owner is already a user or aliased in the database.

It doesn't make sense to me that I can only assign a database owner that does NOT exist.  What am I missing here?

Thanks,

Linda
0
Comment
Question by:VMKuser
5 Comments
 
LVL 5

Expert Comment

by:dannygonzalez09
ID: 39632266
try recreating the user

USE MyDB
GO
SP_DROPUSER ‘test_user’ – Dropping test_user from the user database
GO
SP_CHANGEDBOWNER ‘test_user’ – Changing the OWNER of the database

Check this Kb article
http://support.microsoft.com/kb/866052
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 39632375
Did you re-sync any/all "orphaned" users in that db?

In particular, we need to make sure that user 'netadmin' is not orphaned:

USE <your_db_name>
EXEC sp_change_users_login 'UPDATE_ONE', 'netadmin', 'netadmin'

Then see if it's now accurately shown as the (already existing) owner:

EXEC sp_helpuser
0
 
LVL 26

Accepted Solution

by:
Zberteoc earned 500 total points
ID: 39632391
Change the owner to sa like this:

ALTER AUTHORIZATION ON DATABASE::MyDatabase TO sa
0
 

Author Comment

by:VMKuser
ID: 39632636
None of these worked when I was trying to change the dbowner to 'netadmin', an administrator account.  But when I tried changing to 'sa', zberteoc's suggestion worked.  So I guess 'sa' will remain the owner of the db.  Works for me.

Thanks, everyone.
0
 
LVL 26

Expert Comment

by:Zberteoc
ID: 39633477
Another thing you can do is to use the UI from Management Studio. You should have MS 2008 after upgrade. To change the owner:

1. Right click on the database name
2. Click Properties
3. On left panel choose Files
4. In the right panel you can change the Owner by either typing the whole name if you know it or you can search it on your domain if you click on ...(domain users)

At this point you can apply the changes in 2 ways:

1. Click OK
2. Click on the Script icon in the top left corner, which will generate the SQL script in a new query window and you can run it from there.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now