Wednesday, 27 December 2017

SQL SERVER CLR Error

Error:
Msg 6263, Level 16, State 1, Line 721
Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option.


Solution ; We need to enable the CLR in the SQL Server configuration.

sp_configure 'show advanced options',1
go
sp_configure 'clr enabled',1
go
reconfigure
go


Error:
Msg 10314, Level 16, State 11, Line 2
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65536. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:


Solution 1 : When the databases is restored\attached from the different instance this error might occurred as the CLR objects will be looking for the same owner SID which was created at the source. Changing the databases owner to the same as source and giving the required permission would fix the issue.

Alternatively we can use db owner as ‘sa’ also.

USE <DatabaseName>
GO
EXEC sp_changedbowner 'sa'


Solution 2 : The quickfix would be to set the database to trustworthy: 

ALTER DATABASE <DatabaseName> SET TRUSTWORTHY ON

Solution 3 : You can also navigate to Assemblies of a respective databases and change the Assembly property.  Set the permission to ‘External Access or unrestricted’







No comments:

Post a Comment