Error modifying image during creation -
I am running a modification script during an image creation however the script needs to drop tables in the database. When the image creation process gets to the end it generates this error:
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.
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.
Tagged:
Best Answer
-
Mark R Posts: 49 Silver 1Ah - 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.
Software developer
Redgate Software
Answers
Redgate Software
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.
AND LEFT(name, 8) <> 'SqlClone'
So it excludes the temp user.
Cheers.
Still learning about SQL Clone....