Comments
2 comments
-
Hello @don_don,
SQL Clone creates a temporary low privilege user account to run the template script. The only role of this account is the db_owner.
The first issue arises because this account hasn't permissions to alter the authorization of the database, and the second because at the last step it tries to delete the temporary user, but it can't since the database is read-only.
What I'd suggest is to create a PowerShell script that will call the Clone cmdlet and after that it will alter the authorization of the database and make it read-only.
Kind regards,
Panagis -
Hey there, Panagis -- thank you for responding. Your guidance confirmed my suspicions based on what I was seeing while trying to automate this process. And your thoughts about the powershell script running the clone and then mopping up is exactly what I was planning to do. Take care.
Add comment
Please sign in to leave a comment.
I realize I could do the subject tasks in a separate step using a number of different approaches -- but I'm curious why I can't during the cloning process with a template. The help files tell me that the template is run after the clone is created so the 'database' exists with the name it needs to be. As part of our compliance and standards, I set all new database owners to a non-transitory AD account; when the clone is created, the owner is the account which I'm using to run the image=>clone process. When I execute: