SQL DBA Blog: Home

  • RESTORE Is Terminating Abnormally (Errors 3013 and 3241)

    3013 is never the cause, it is the last line of a failed restore. Five restore failures reproduced in a container, five different real errors above it, and three of them had nothing wrong with the backup file.

    Read More


  • Insufficient System Memory and Memory Grant Timeouts (Errors 701 and 8645)

    701 is the server unable to find memory at all. 8645 is the memory existing and being held by someone else. Neither one means buy more RAM, and cumulative wait stats will mislead you about both.

    Read More


  • The Backup Set Holds a Backup of a Database Other Than the Existing Database (Error 3154)

    🚨Part of the SQL Server Errors series, the exact messages and what actually causes them.In: Backup & Recovery What Msg 3154 Says Msg 3154  ·  Level 16  ·  State 4 The backup set holds a backup of a database other than the existing ‘Sales’ database. Msg 3013, Level 16, State 1 RESTORE DATABASE is terminating…

    Read More


  • The Database Could Not Be Exclusively Locked to Perform the Operation (Error 5030)

    🚨Part of the SQL Server Errors series, the exact messages and what actually causes them.Related pillar: Blocking & Locking Msg 5030 means another connection has the database open. Find that session before retrying the operation. What Msg 5030 Says Msg 5030  ·  Level 16  ·  State 2 The database YourDb could not be exclusively locked…

    Read More


  • Incorrect Syntax Near in SQL Server (Error 102)

    Msg 102 usually is not a typo. If the same statement runs on one database and fails on another, the parser grammar is chosen by compatibility level, not by the version of the instance.

    Read More


  • Log and Filter sp_who2 Results in SQL Server

    sp_who2 has no WHERE clause. Capture its output into a thirteen column table with INSERT … EXEC and it becomes queryable, including a logging table you can run on a schedule. Plus the two errors that stop most people, and the DMV to use instead.

    Read More


  • Conversion Failed When Converting the varchar Value to Data Type int (Error 245)

    🚨Part of the SQL Server Errors series, the exact messages and what actually causes them.Related pillar: Performance & Troubleshooting Msg 245  ·  Level 16  ·  State 1 Conversion failed when converting the varchar value ‘N/A’ to data type int. ⚡Quote the literal first. int outranks varchar, so an unquoted number makes SQL Server convert the…

    Read More


  • The DELETE Statement Conflicted With a FOREIGN KEY Constraint (Error 547)

    🚨Part of the SQL Server Errors series, the exact messages and what actually causes them.Related pillar: Performance & Troubleshooting Msg 547  ·  Level 16  ·  State 1 The DELETE statement conflicted with the REFERENCE constraint “FK_OrderLines_Orders”. The conflict occurred in database “Sales”, table “dbo.OrderLines”, column ‘OrderId’. ⚡Query sys.foreign_keys before you fix anything. SQL Server reports…

    Read More


  • Invalid Object Name in SQL Server (Error 208)

    🚨Part of the SQL Server Errors series, the exact messages and what actually causes them.Related pillar: Performance & Troubleshooting What Msg 208 Says Msg 208  ·  Level 16  ·  State 1 Invalid object name ‘Orders’. ⚡Run SELECT DB_NAME(), SCHEMA_NAME() before anything else. Four contexts produce this error and three of them are about where you…

    Read More


  • DBA Scripts: Migration and Deployment

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks. A SQL Server migration fails in two places: before it starts, when nobody checked whether the workload even fits the target, and after it finishes, when logins don’t match, users are orphaned, and the first Monday morning proves the move wasn’t as done…

    Read More