Comments
4 comments
-
What's the result of the script when it's run from SSMS?Are you able to share the script?
-
The script is supposed to delete all the users so the image created has no permissions. The script runs fine in SSMS because it uses my account. But SQL Clone is creating what I assume is a temporary account called SqlClone_LowPriv_1l5. So when the script runs it fails because it cannot remove SqlClone_LowPriv_1l5.
This is what appears in the log:
The server principal "SqlClone_LowPriv_1l5" is not able to access the database "SqlCloneTemp_4hojwsno" under the current security context.
My aim is to run a modification script to remove permissions and various table backups on the production database. Then I have a nice clean image of the database to then clone.
Thanks.
-
Ah - if you're trying to remove all the users, you'll need to exclude the SQL Clone temporary user. That user will be removed by SQL Clone at the end of the script, and won't be present in the image, so you don't need to remove it yourself. The script can't remove that user because the script is running as that user, and you can't remove the user you're running as.
-
Thanks Mark R. I had to amend my TSQL to include this line:
AND LEFT(name, 8) <> 'SqlClone'
So it excludes the temp user.
Cheers.
Still learning about SQL Clone....
Add comment
Please sign in to leave a comment.
An exception was thrown while executing a script: System.Data.SqlClient.SqlError: Cannot drop the table '<tablename>', because it does not exist or you do not have permission.
Both the SQL Clone and SQL Clone Agent account has the role sysadmin so not sure what permission is needed.
Thanks.