Sunday, March 11, 2012

Detaching a database in SQL2005 is changing the security of the files

For some reason when I detach a database from my SQL 2005 server using
my client machine, the security of the database files changes so that
I am the only user with security to that file. It even removes all of
the Administrators that were there. If I attach the database back,
the security then changes back to the users that were originally there
and my username is gone. Any ideas as to why this is happening or if
it should work this way?
Yes, this is exactly what is supposed to happen.
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/849b9f34-baac-48f2-b953-7bc96f58526f.htm
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
<tharris@.krispykreme.com> wrote in message
news:1172780956.981600.79660@.v33g2000cwv.googlegro ups.com...
> For some reason when I detach a database from my SQL 2005 server using
> my client machine, the security of the database files changes so that
> I am the only user with security to that file. It even removes all of
> the Administrators that were there. If I attach the database back,
> the security then changes back to the users that were originally there
> and my username is gone. Any ideas as to why this is happening or if
> it should work this way?
>
|||Thanks for the reply. It makes sense that that attach cleans up the
file security to only the necessary users, but it doesn't make sense
to remove the administrators when detaching the database.
On Mar 1, 3:49 pm, "Geoff N. Hiten" <SQLCrafts...@.gmail.com> wrote:
> Yes, this is exactly what is supposed to happen.
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/849b9f34-baac-48f2-b953-7bcX96f58526f.htm
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
> <thar...@.krispykreme.com> wrote in message
> news:1172780956.981600.79660@.v33g2000cwv.googlegro ups.com...
>
>
> - Show quoted text -
|||I am also having a problem with the detach. After detaching a database I get
a message that I cannot copy the database because it is in use. How can it be
inuse if it is detached. I have used detach and attach to copy databases for
years and this is the first time I have had this problem. It is also the
first time I am using SQL 2005. Is there anything in 2005 that doesn't get
cleaned up on the detach that could be doing this. Any info would be great.
CookCountySQLUser
"tharris@.krispykreme.com" wrote:

> For some reason when I detach a database from my SQL 2005 server using
> my client machine, the security of the database files changes so that
> I am the only user with security to that file. It even removes all of
> the Administrators that were there. If I attach the database back,
> the security then changes back to the users that were originally there
> and my username is gone. Any ideas as to why this is happening or if
> it should work this way?
>
|||How about using some tool to say which process is using the file? I believe that sysinternals (now
MS) has such tools).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"CookCountySQLUser" <CookCountySQLUser@.discussions.microsoft.com> wrote in message
news:69A376CB-D973-4EF8-9778-32D4D0F8B152@.microsoft.com...[vbcol=seagreen]
>I am also having a problem with the detach. After detaching a database I get
> a message that I cannot copy the database because it is in use. How can it be
> inuse if it is detached. I have used detach and attach to copy databases for
> years and this is the first time I have had this problem. It is also the
> first time I am using SQL 2005. Is there anything in 2005 that doesn't get
> cleaned up on the detach that could be doing this. Any info would be great.
> CookCountySQLUser
> "tharris@.krispykreme.com" wrote:

No comments:

Post a Comment