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
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?
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]
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.
This message is likely related to permissions to the SQL user account on the new instance.
USE ;
EXEC sp_configure 'clr enabled' ,1
GO
USE
GO
EXEC sp_changedbowner 'sa'
USE
GO
ALTER DATABASE SET TRUSTWORTHY ON;
YOU ARE DONE...!
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.
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