How do i change the owner of my database

  • Hi,

    We have just installed a new Windows Small Business 2008 server at work & our company database was restored from SQL 2000 into SQL Server 2008 under a domain administrator account called da2. Our computer supplier decided (without my knowledge) to delete the da2 account a few days after our server installation & they left the da account on the server. This has now caused me problems because when i login into SQL Server 2008 under da account my database is only shown in snapshot view & i can't gain any access to it. If i re-create the da2 account on the server it does not allow me access either.

    Can anyone help me with taking control of database or am i totally doomed?:angry:

  • I dont think you can drop a Login, if it owns a database. IF you restore / attach the database, it will take the name of the person who has restored / attached the database, unless the owner is changed after the restore.

    However, you can change the owner of the database by

    use "DBNAME"

    go

    EXEC sp_changedbowner 'da'

    This is the reason I always alter my database Owners to SA as soon as I create them. Keeps it hassle free.

  • Thanks so much for you reply! I tried your suggestion:

    use "BackendPrestigeSQL"

    go

    EXEC sp_changedbowner 'da'

    and i get the following error:

    The EXECUTE permission was denied on the object 'sp_enable_sql_debug', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)

    Is there something else i need to do here?

  • Only members of the sysadmin fixed server role can execute sp_changedbowner.

    I don't think you are having SysAdmin access currently.

    You may check your permission details on your current db using below command.

    EXEC sp_helprotect NULL, 'UserName'

    M&M

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply