I have a script that detaches databases for archival when they meet certain criteria. The script is executed by SSIS under the local Administrator account by the Ghost of DBA Past. Per design it (by this I meant detaching databases in general) removes all other ownership and makes ownership exclusive to the local Administrator account. Here's where it gets weird:
I can't seem to change permissions back except via two methods:
- Windows GUI properties/Security etc.
- Copying the files to a sub directory that has inherited different permissions.
What I can't get to work:
- PowerShell Set-Acl
- PowerShell Move-Item
- Moving/cutting the files in Windows GUI
I understand why ownership changes, but not why it's so difficult to edit the permissions afterwards, and why the files seem to essentially be hidden from command line tools.
Reason for the change is that sometimes data needs to be put back online before it goes to tape for whatever reason, and I can't attach the database(s) without changing permissions first.