valid dbo user

Hello,

I'm brand new to Visual C#. I'm trying to create a database to link a windows form to. I've made some tables and when I try to create a database diagram I receive an error: "The database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming in not available. Do you want to make yourself the dbo of this databases in order to use database programming " When I select "Yes" I again receive an error message. Can anyone tell me how to access teh dbo account or give myself permisssion to impersonate the dbo account I'm following a tutorial, but of course the instructor didn't run into this issue.

Any and all suggestions much appreciated,

Vincent



Answer this question

valid dbo user

  • Gino_D_Animal

    I had this same issue. After searching this forum I had the cues I needed to correct the issue but none of the suggested methods worked. I think the problem stemed from the fact that I had renamed the primary windows user account to my name (the original Owner account left from the OS install). In the folder structure some of the folders were still titled "Owner" but further down the tree the new name was used. So this account was previously "Owner" but had been changed to my name. The solution was the create a new Windows account, all of the folders had the new name associated with them. Then I recreated the database and the problem accessing the database diagram didn't reoccur. I hope this helps.

  • Mark Gabarra - MSFT

    From the brief explanation you gave, I am assuming that you are connecting the the database using a windows Account, To grant yourself dbo rights you have 2 options. The first is to use the management studio for you sql server system, go to the security tab and find your user name. If your user name is not there it is more then likely that you are using permissions based on a security group.... You will have to either find your security group that you are falling into, or create yourself a login to the Database server. Once done or found you can then open the user dialog and adjust the database roles for you user and add db_owner for the database in question.

    Option 2 is to use the raw TSQL and grant the db_owner database role to your account, this is done by running a new query inside the management studio or using the command line tools. You can get more information on this from the Books online (SQL Server Documentation).

    I would suggest to use the Management studio system for the version of SQL that you have installed. If you have installed standard or above you will already have it installed, but if you have the express version this is an additional download that you can get from the MS Download site.



  • blanc0

    You see this error installing the diagram support stored procedures when the logged in user cannot impersonate the database owner. There are a few reasons why this can happen.

    First, if the database has been copied or restored from another server and the database was owned by a SQL Authentication login on the other server, then the name of the owner will be in the system tables, but the name won't map to a valid security identifier. Since the database doesn't have a valid owner, the owner can't be impersonated. Changing the database owner to a valid login on the new server fixes this problem.

    Second, if the database is owned by a Windows Authentication login, but there is a problem communicating with the Windows Domain Controller, it may be the case that the owner can't be impersonated. This can be fixed by restoring communication with the domain controller, or else by creating a SQL Server authentication login to own the database. If your company has a policy against using SQL Authentication logins, you can deny connect permission to the login so it can't be used to connect to the server.

    Finally, the owner of the database might be ok, but you might not be logged in as an administrator in which case not being allowed to impersonate the database owner is legit.

    Members of the Administrators group on the machine connect as SA when they connect to the SQL Server using Windows authentication. So if you are an administrator, you can just login as yourself and make any changes you need to make.

    If you aren't an administrator on the machine and you don't have the an adminsitrator password, you are not allowed to change the owner of a database, which is a good thing.

    Hope this helps,
    Steve



  • Chris Breier

    Following the Absolute Beginner’s Video Series video 8 on the http://msdn.microsoft.com/vstudio/express/vb/learning/

    and ran into the same issue when trying to create a db diagram (ie. "this db does not have a valid dbo").

    The solution of "restoring communication with the domain controller" worked, but this means I need to vpn to my work network in order to be authenticated, and our VPN service does not allow simultaneous internet access and i am trying to learn VB on my own time. So I lose access to this forum. Your suggestion to "else by creating a SQL Server authentication login to own the database" sounds like a better solution but it is not clear to me where i do this.

    I installed the default MSDN Visual Studiko 2005 Professional Edition", and I not sure where to change the authentication login.

    The start menu has:

    Start>

    Visual Studio 2005>

    Visual Studio Remote tools>

    Visual studio 2005

    Visual studio 2005 documentation

    SQL Server 2005

    Configuration tools

    SQL Server Configuration Manager

    SQL Server Error and Usage Report

    SQL Surface Area configuration

    Inside of the Visual Studio IDE, I have a "Server Explore Window" that lists my computer and various items like "management classes".

    I would greatly appreciate it if you could point me in the correct place to make this change.


  • Dave Bartolomeo - MSFT

    I had the exact same symptom, but a really strange issue to resolve it. For some strange reason I happened to glance down at the Owner property and noticed that the server name was wrong. I tried everything to modify this property, but I could find anything. I simply renamed my system, rebooted, and all my problems went away. Not a pretty fix. I have no idea why Visual Studio 2005 thought my system name was something different then what it really was and why it fixed it when I changed the name to what it thought it was... :) If anyone has any thoughts I would love to know, but at least I am back in business for tonight!

    Tim


  • Tomsi

    hi,

    i'm not sure but in this link lesson 7 has some explanation for this http://msdn.microsoft.com/vstudio/express/sql/learning/default.aspx

    hope this helps



  • valid dbo user