SQL Server stops loading assembly

后端 未结 13 1473
花落未央
花落未央 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:22

    I suspect you are not disposing your SqlConnection and SqlCommand instances inside your assembly, which is why it's running out of resources. Either that or it has a memory leak, can you post the code?

    0 讨论(0)
  • 2020-12-13 00:23

    Just in case someone comes across this problem, the solution that worked for me was:

    ALTER AUTHORIZATION ON DATABASE::[mydb] TO sa;
    

    followed by

    ALTER DATABASE [mydb]  SET TRUSTWORTHY ON;
    

    I am restoring my db with the Administrator account, and nothing else other than the combination of these two calls has worked for me.

    Substitute [mydb] for [yourdatabasename]

    0 讨论(0)
  • 2020-12-13 00:23

    I found the same issue. In my case the CLR assembly was compiled for x86 cpu. After I changed the cpu to ANY CPU this issue was resolved since my SQL server is 64 bits.

    I hope this useful.

    0 讨论(0)
  • 2020-12-13 00:26

    This message is likely related to permissions to the SQL user account on the new instance.

    1. Ensure that SQL Server Management Studio is installed on the server.
    2. Login into the new instance (Servername\Acctivate) using a windows user account or a SQL User.
    3. Run the following script below FOR THE DATABASE HAVING ISSUES WITH….

    USE ;

    EXEC sp_configure 'clr enabled' ,1

    GO

    USE

    GO

    EXEC sp_changedbowner 'sa'

    USE

    GO

    ALTER DATABASE SET TRUSTWORTHY ON;

    YOU ARE DONE...!

    0 讨论(0)
  • 2020-12-13 00:28

    I experienced it. it seems when you restore a database TRUSTWORTHY set to OFF. so my solution was to turn it on :

    ALTER DATABASE [myDB] SET TRUSTWORTHY ON
    GO
    

    and after i turned it on, my triggers and stored procedures started to work like before.

    0 讨论(0)
  • 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
    
    0 讨论(0)
提交回复
热议问题