Pre script running issue
Satish
Posts: 2
Hi,
we ran into a problem while using the Red-Gate SQL Packager 6.4.0.8
We built a package and tried running it on a server where the packager is supposed to create a new database. The problem occurred when the packager tried to install a .net assembly file(dll) into the newly created database.
It threw an error that said
“CREATE ASSEMBLY for assembly 'Delta.SQLCLR' failed because assembly 'Delta.SQLCLR' is not authorized for PERMISSION_SET = UNSAFE. The assembly is authorized when either of the following is true: the database owner (DBO) has UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.â€
This could be fixed by using the statement “SET TRUSTWORTHY ON†on the newly created db.
But when we made the above script a part of the preSQL script and ran the packager in command line, it did not seem to have executed the above script and came back with the same error.
we ran into a problem while using the Red-Gate SQL Packager 6.4.0.8
We built a package and tried running it on a server where the packager is supposed to create a new database. The problem occurred when the packager tried to install a .net assembly file(dll) into the newly created database.
It threw an error that said
“CREATE ASSEMBLY for assembly 'Delta.SQLCLR' failed because assembly 'Delta.SQLCLR' is not authorized for PERMISSION_SET = UNSAFE. The assembly is authorized when either of the following is true: the database owner (DBO) has UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.â€
This could be fixed by using the statement “SET TRUSTWORTHY ON†on the newly created db.
But when we made the above script a part of the preSQL script and ran the packager in command line, it did not seem to have executed the above script and came back with the same error.
Comments
The /presql is run before the database is created, so it won't have actually made the change you expect.
One option would be to create the DB as part of your Pre-script, for instance if I wanted to create a table first:
Then, in your commandline, specify the DB you just created and the /makeupgrade switch as opposed to the /makedatabase switch.
Hopefully that should help get around the problem.
Redgate Software