[dba-SQLServer] Changing database ownership

jwcolby jwcolby at colbyconsulting.com
Mon Feb 4 10:13:30 CST 2008


Arthur,

I think this won't work in my case because the other server is already taken
down, no longer exists, so I can't "get at" it.  Since it did in fact
attach, albeit with an error message, I can do what you are talking about
with the mounted instance.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur
Fuller
Sent: Monday, February 04, 2008 10:19 AM
To: Discussion concerning MS SQL Server
Subject: Re: [dba-SQLServer] Changing database ownership

I have had similar problems, JC, and I don't quite understand why and how to
fix it easily. I do however have a work-around that seems to work.
Inelegant, I know, but if it works, it works, until some bolt of insight
strikes me.

1. Create a new database. Check that it is sound by opening the database
diagrams node on said database. It will either tell you that the stuff is
not installed and ask if you want to install it (This is good), or it will
tell you that you aren't the owner.
2. Assuming you are the owner, then use the Import Wizard to grab all the
data, sprocs, views, etc. from the other database and import them into the
newly created one.

After that, you can safely delete the old database.

A.

P.S.
Supposedly there is a simple system stored procedure to let you change the
ownership but I've had problems with it. Thus I experimented and came up
with the recipe above.



On Mon, Feb 4, 2008 at 10:07 AM, jwcolby <jwcolby at colbyconsulting.com>
wrote:

> I have another piece of SQL Server that I do not understand.  I 
> generally work from my laptop (M90). I open SQL Server and create a 
> database out on one of my servers.  I had two servers at the time, but 
> I am down to one now.
> At the time I was creating a lot of the databases on server AZUL.  
> Azul's motherboard died and I moved the databases off to server 
> Stonehenge.  When I try to attach the databases I get an error 
> something to the effect "cannot attach because the user M90.jwcolby is 
> not available".  Obviously m90.jwcolby is my user on my laptop, but 
> why doesn't it just ask me for my username / password or something?  
> And how do I change the ownership to Stonehenge.user or something like 
> that?  Do I even want to do so?
>
> To make matters even stranger, the attach works!  So I am able to 
> continue truckin on but it is just one of those "panic moments" when I 
> think that I am going to be locked out of my database.
>
> Does anyone have an English language explanation of what is happening, 
> why, and how to cause it to go away?
>
> John W. Colby
> Colby Consulting
> www.ColbyConsulting.com <http://www.colbyconsulting.com/>
>
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list