patternsqlMinor
Possible to detach a database from SQL Server while retaining file permissions?
Viewed 0 times
filewhilepermissionsdetachsqldatabasepossibleserverfromretaining
Problem
When a user detaches a database from MS SQL Server, it sets the owner of the data and log files to that user. It also removes all non-owner permissions from the files. This is partially explained at http://msdn.microsoft.com/en-us/library/ms189128.aspx
I have tested this on the following versions of SQL Server
Is it possible to change this behavior so file permissions are retained when a database is detached?
I have tested this on the following versions of SQL Server
- 2005
- 2008
- 2008 R2
Is it possible to change this behavior so file permissions are retained when a database is detached?
Solution
While not a concrete answer, I find no configuration option or setting to override this behavior. It seems to be baked in.
Everywhere Detaching and Attaching Databases is mentioned in the documentation points back to the Securing Data and Log Files page you referred to above. The scenario on this page makes it pretty clear what is going on, and why the files should be secured as such.
Perhaps you could use a different user or service account to perform the operation? IF the file is owned by the proper account (such as the SQL Server service account) this whole thing may be a non-issue.
Everywhere Detaching and Attaching Databases is mentioned in the documentation points back to the Securing Data and Log Files page you referred to above. The scenario on this page makes it pretty clear what is going on, and why the files should be secured as such.
Perhaps you could use a different user or service account to perform the operation? IF the file is owned by the proper account (such as the SQL Server service account) this whole thing may be a non-issue.
Context
StackExchange Database Administrators Q#6752, answer score: 7
Revisions (0)
No revisions yet.