SQL Server stops loading assembly

后端 未结 13 1483
花落未央
花落未央 2020-12-13 00:12

We have developed an assembly for SQL Server 2008 R2.

The assembly has been working for a week. The managed stored proc inside the assembly was working fine for the

13条回答
  •  爱一瞬间的悲伤
    2020-12-13 00:34

    I restored the DB from server to my local machine and ran into this error. Try the below two queries. For me, the first query worked:

    --First Query

    ALTER DATABASE [database_name] SET TRUSTWORTHY ON;
    GO
    
    USE [database_name]
    GO
    
    EXEC sp_changedbowner 'sa'
    GO
    

    --Second Query -- Enabling CLR Integration if it is set to false

    IF ((SELECT [value] FROM sys.configurations WHERE [name] = 'clr enabled') = 0)
    BEGIN
    EXEC sp_configure 'clr enabled', 1
    RECONFIGURE
    END
    GO
    

    -- Disabling CLR strict security, if it is set to true

    IF EXISTS(SELECT 1 FROM SYS.CONFIGURATIONS WHERE name = 'clr strict security' AND [value] = 1)
    BEGIN
    IF EXISTS(SELECT 1 FROM SYS.CONFIGURATIONS WHERE name = 'show advanced options' AND [value] = 0)
    BEGIN
    EXEC sp_configure 'show advanced options', 1
    RECONFIGURE 
    END
    
    EXEC sp_configure 'clr strict security', 0
    RECONFIGURE 
    END
    GO
    GO
    

提交回复
热议问题