Solved

Change Database Owner

Posted on 2013-11-07
5
385 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:Scott Pletcher
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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL 2008 Conversion failed 7 20
Help with SQL - TOP 10 by date and by group 13 34
Generate Weekly Schedule 15 17
SQL Pivot Rows To Columns 9 22
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

19 Experts available now in Live!

Get 1:1 Help Now