Saturday, May 16, 2015

The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE.

Error :
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65554. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE.

Solution 1: KB Article
https://support.microsoft.com/en-us/kb/918040

Solution 2: Change the Permission Set : External

While doing this faced the below error :

ERROR: 
The database owner SID recorded in the master database differs from the database owner SID recorded in database
To check who is the owner listed in the master database run the following:

SELECT  SD.[SID]
       ,SL.Name as [LoginName]
  FROM  master..sysdatabases SD inner join master..syslogins SL
    on  SD.SID = SL.SID
 Where  SD.Name = ''


To correct this issue, run the following command:

Alter Authorization on Database:: to []

Once done set the required settings on the properties of Assembly.

Thursday, April 16, 2015

Mirroring Endpoint Owner Changing



Breaking mirror and recreating by logging into the desired account will be the easiest way. But we can follow the below steps to fix the account without breaking.

1. Query to find the current endpoint owner of the instance and take a note.

SELECT [PrincipalName] = sp.name, [PrincipalId] = sp.principal_id, me.* FROM sys.database_mirroring_endpoints me with(nolock)
inner join sys.server_principals sp with(nolock) on me.principal_id = sp.principal_id

2. New endpoint not exists then we need to create as login and need to be granted the following authorization.

GRANT CONNECT ON ENDPOINT::Mirroring TO [Domain\LOGINNAME];
ALTER AUTHORIZATION ON ENDPOINT::Mirroring TO [Domain\LOGINNAME];

3. Verify the current owner of endpoint using step 1.

Wednesday, April 15, 2015

SQL Server Agent - xp_readerlog[] returned error3 -System can not find the path specified

Here in the steps to follow:



USE MASTER
GO
EXEC msdb..sp_get_sqlagent_properties
GO

USE MASTER
GO
EXEC msdb.dbo.sp_set_sqlagent_properties
@errorlog_file=N'PATH'  -- N'k:\MSSQL10_50\MSSQL\Log\SQLAGENT.OUT'
GO


USE MASTER
GO
EXEC msdb..sp_get_sqlagent_properties
GO


Restart SQL server agent.