Common SQL Errors and Solutions

Error : Msg 7411, Level 16, State 1, Line 1 Server ‘DEVSQLDEV2008’ is not configured for RPC. Solution :

exec sp_serveroption @server='DEVSQLDEV2008', @optname='rpc', @optvalue='true'
exec sp_serveroption @server='DEVSQLDEV2008', @optname='rpc out', @optvalue='true'

Error : 2014-09-11 16:14:23.410 Logon SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT: 192.168.63.109] 2014-09-11 16:14:23.430 Logon Error: 18452, Severity: 14, State: 1. Solution : Most of the times Flushing the DNS helps me resolve this issue.

IPConfig/FlushDNS

SQL Error : Msg 10314, Level 16, State 11, Line 130 An error occurred in the Microsoft .NET Framework while trying to load assembly id 65549. 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: System.IO.FileLoadException: Could not load file or assembly ‘lighthouseclr, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A) System.IO.FileLoadException: at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString)

Solution:
When you encounter this error , change the database owner to sa and then set the trustworthy on for the Database.

EXEC dbo.sp_changedbowner @loginame = N'sa', @map = false
go
exec sp_changedbowner 'sa'
go
alter database PAPortal
set trustworthy on  --after restoration database has this option equal to off
go
EXEC dbo.sp_changedbowner @loginame = N'sa', @map = false
DECLARE @pDBName VARCHAR(128)
SELECT   @pDBName = DB_NAME()
EXEC ( 'ALTER DATABASE '+ @pDBName + '
SET TRUSTWORTHY ON ')  --after restoration database has this option equal to off

Error :
Msg 15281, Level 16, State 1, Procedure sp_send_dbmail, Line 0
SQL Server blocked access to procedure ‘dbo.sp_send_dbmail’ of component ‘Database Mail XPs’ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘Database Mail XPs’ by using sp_configure. For more information about enabling ‘Database Mail XPs’, see “Surface Area Configuration” in SQL Server Books Online.

Solution :
EXEC sp_configure 'Database Mail XPs',1
GO
RECONFIGURE
GO

——————————————-
—START RAPID DEVELOPEMENT SQL SCRIPT—–
—SQL COMPILED BY: Raju Venkataraman
—SCRIPT RAN ON DB: master
—SCRIPT START TIME: 2014-10-28 18:51:45.043
—Application : Microsoft SQL Server Management Studio – Query
—TranCount : 0
——————————————-
Msg 5315, Level 16, State 1, Line 301
The target of a MERGE statement cannot be a remote table, a remote view, or a view over remote tables.

Msg 3964, Level 16, State 1, Procedure sp_ProcedureName, Line 82
Transaction failed because this DDL statement is not allowed inside a snapshot isolation transaction. Since metadata is not versioned, a metadata change can lead to inconsistency if mixed within snapshot isolation.

Solution:
https://msdn.microsoft.com/en-us/library/bb933783.aspx
This error can occur if you are querying metadata under snapshot isolation and there is a concurrent DDL statement that updates the metadata that is being accessed under snapshot isolation. SQL Server does not support versioning of metadata. For this reason, there are restrictions on what DDL operations can be performed within an explicit transaction running under snapshot isolation. An implicit transaction, by definition, is a single statement which makes it possible to enforce the semantics of snapshot isolation even with DDL statements. The following DDL statements are not permitted under snapshot isolation after a BEGIN TRANSACTION statement: ALTER TABLE, CREATE INDEX, CREATE XML INDEX, ALTER INDEX, DROP INDEX, DBCC REINDEX, ALTER PARTITION FUNCTION, ALTER PARTITION SCHEME, or any common language runtime (CLR) DDL statement. These statements are permitted when you are using snapshot isolation within implicit transactions. An implicit transaction, by definition, is a single statement which makes it possible to enforce the semantics of snapshot isolation even with DDL statements.

Error:
SQL Server Reporting Services
Error
User 'Domainuser' does not have required permissions. Verify that sufficient permissions have been granted and Windows User Account Control (UAC) restrictions have been addressed.
Home

Solution:
Open the Internet Explorer as Administrator and access the URL. It will work.

Trying to Install bacpac database on Local SQL Server
Internal Error.  The internal target platform type SqlAzureDatabaseSchemaProvider does not support schema file version '2.5'. (File: .bacpac) (Microsoft.Data.Tools.Schema.Sql)
TITLE: Microsoft SQL Server Management Studio
------------------------------
Count not load schema model from package. (Microsoft.SqlServer.Dac)
------------------------------
ADDITIONAL INFORMATION:
Internal Error.  The internal target platform type SqlAzureDatabaseSchemaProvider does not support schema file version '2.5'. (File: .bacpac) (Microsoft.Data.Tools.Schema.Sql)

Solution:
Download the latest DACFramework and Install it. It fixed problem for me.
http://www.microsoft.com/en-us/download/confirmation.aspx?id=39976

Error:
/*
Msg 7630, Level 15, State 3, Line 4
Syntax error near '-' in the full-text search condition '9-12.P.2.2-B008 - Physical Science - Newton'.
*/

Solution:
Append Double Quotes around the search string.

DECLARE @QueryText NVARCHAR(500)
SELECT  @QueryText = '9-12.P.2.2-B008 - Physical Science - Newton'
SELECT  *
FROM    CONTAINSTABLE(dbo.TableName, ( FTColumn1, FTColumn2 ), @QueryText)
GO
/*
Msg 7630, Level 15, State 3, Line 4
Syntax error near '-' in the full-text search condition '9-12.P.2.2-B008 - Physical Science - Newton'.
*/
DECLARE @QueryText NVARCHAR(500)
SELECT  @QueryText = '9-12.P.2.2-B008 - Physical Science - Newton'
SELECT  @QueryText = '"' + @QueryText + '"'
SELECT  *
FROM    CONTAINSTABLE(dbo.TableName, ( FTColumn1, FTColumn2 ), @QueryText)

Communication Buffer Resources ( Memory Issues Deadlock )

Msg 1205, Level 13, State 52, Procedure TestSession_InsertTestUser, Line 417
Transaction (Process ID 163) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

clr enabled Configuration Error

Msg 6263, Level 16, State 1, Line 277
Execution of user code in the .NET Framework is disabled. Enable “clr enabled” configuration option.

EXEC sp_configure 'show advanced options' , '1'
RECONFIGURE
GO
EXEC sp_configure 'clr enabled' , '1'
RECONFIGURE
GO
Error Solution
EXECUTE AS USER = ‘Login’;
SELECT * FROM fn_my_permissions(NULL, ‘DATABASE’);
REVERT;/*
The database owner SID recorded in the master database differs from the database owner SID recorded in database ”.
You should correct this situation by resetting the owner of database ” using the ALTER AUTHORIZATION statement.
*/
EXEC sp_changedbowner ‘sa’

Table Level Change Tracking Error

Msg 22105, Level 16, State 1, Procedure xxxxxxxxxxxx, Line 96 [Batch Start Line 4]
Change tracking is not enabled on table ‘dbo.SampleTable’.

ALTER TABLE dbo.SampleTable
ENABLE CHANGE_TRACKING
WITH (TRACK_COLUMNS_UPDATED = ON)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *