I installed a SQL Server 2008 on a machine and created a database on it. Subsequently, the machine that this was installed on was added to a Windows domain and it appears the original local user account that Server Server was install on was renamed or deleted. Now, I'm unable to connect to the database using a domain administrator, newly created local administrator account, or the local system account. When I attempt to expand the database in SQL Server Management Studio I get the error "The database is not accessible. (Object Explorer)". Is there any way I can get access to the database? I want to somehow just make a copy of the .mdf file and recreate it in Management Studio and then just overwrite the newly created one with the copy but I suspect this will maintain the permission issues that I have now. Any ideas are welcome.
1 Answer
Log into Windows with the old username, but prefix it with the computer's name.
For example:
PCNAME\Username
If that doesn't work, let us know and we can help with the next step.
If you can connect to the SQL instance, can you do so as Administrator? If so, all you have to do is change the owner of the DB. Right-click on the database, go to Properties, then Files, and change the owner there.
-
Thanks but the old user may have been deleted. I'm still investigating whether it was just renamed or deleted altogether. I assume if it was just renamed I should be to login as the renamed user and everything should work but if the user was deleted is there anything that I can do?– JoshCommented Feb 24, 2011 at 22:03
-
Also, is there a way I can double-check which Windows user account currently owns the database?– JoshCommented Feb 24, 2011 at 22:03
-
Check my updated answer.– user3914Commented Feb 24, 2011 at 22:05
-
Joining a domain doesn't rename or delete local user accounts. Commented Feb 24, 2011 at 22:11
-
1@joeqwerty - it may have been done as a part of IT policy.– user3914Commented Feb 24, 2011 at 22:13