Tuesday, February 14, 2012

Database Owner Problems 2005

I am using SQL Server 2005 and I was having a problem with the owner of a particular database. When I go into Database Diagrams for the database I get:

"Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects."

So I tried some different things (assigning different users as the owner) I was only able to assign one user as the owner (someone that is no longer working here), then I deleted that user (oops.). Now I still don't have an owner assigned AND I can't get into the database properties because I don't have permissions.

Any help would be appreciated.You can set sa as the owner of a db:

USE Mydb
GO

EXEC dbo.sp_changedbowner @.loginame = N'sa', @.map = false
GO
It does sound, though, like you don't have eleveated permissions. You might need to log in as sa or get a sysadmin in to run this.|||That worked. Thanks. The thing that was killing me is that I have the permissions to do it. I am the administrator, user, etc. It is mne and another person that have complete access to the database. We are migrating to SQL Sever 2005 from Access.

If you don't mind answering another question regarding SQL Server security. For this particular database, I try to transfer ownership to my login (which is mapped to my network login, Windows Authentication) and I get the following error:

"The proposed new database owner CORE_PROCESS\dkunkle is mapped as user CORE_PROCESS\dkunkle in this database. Parameter name: CORE_PROCESS\dkunkle"

Any thoughts on this error? My login is the owner of another database. This database was created/developed on another system, then moved to the server.|||If you don't mind answering another question regarding SQL Server security. omg - what a liberty :rolleyes:

I think this means that you are trying to map the owner to a login which is already mapped to a user in the database.

Not certain though. What are you executing?|||Poots has got it ... here's the pertinent section from 2005 BOL


sp_changedbowner [ @.loginame = ] 'login' [ , [ @.map= ] remap_alias_flag ]
http://www.dbforums.com/ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/local/collapse.gif</IMG>Arguments

[ @.loginame = ] 'login' Is the login ID of the new owner of the current database. login is sysname, with no default. login must be an already existing SQL Server login or Microsoft Windows user. login cannot become the owner of the current database if it already has access to the database through an existing alias or user security account within the database. To avoid this, drop the alias or user within the current database first.
[ @.map = ] remap_alias_flag Is the value true or false, which indicates whether existing aliases assigned to the old database owner (dbo) are mapped to the new owner of the current database or dropped. remap_alias_flag is varchar(5), with a default of NULL. This indicates that any existing aliases to the old dbo are mapped to the new owner of the current database. false indicates that existing aliases to the old database owner are dropped.

No comments:

Post a Comment