SQL Server: Fix – Msg 1204, Level 19, State 4 – The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time…

This is an error that does not happen often. In fact, I came across this for the first time when one of my co-workers Inken HOEIJMANS asked me about this. With her permission, I am reproducing her code solution here. Thank you Inken! She was trying to run a MERGE statement using a large source … Continue reading SQL Server: Fix – Msg 1204, Level 19, State 4 – The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time…

Advertisement

SQL Server: Fix: Transaction (Process ID) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction

I have a nightly SQL Agent job that aggregates backup information from system views to power a Power BI dashboard that the DBA's review periodically for database backup failures. It is actually a PowerShell job that runs every night in parallel to collect the data from hundreds of instances (both SQL Server and Oracle). As … Continue reading SQL Server: Fix: Transaction (Process ID) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction

PowerShell & SQL Server: Search & Find Indexes By SchemaName, TableName, IndexName Or ColumnName Across Instances/DB’s

Necessity is the mother of new PowerShell code :-)! Today, I received an email request to get the list of all indexes in a given TableName but the requester did not specify the DatabaseName although the SQL InstanceName was specified. It would be too easy to ask the person for the DBName and script it … Continue reading PowerShell & SQL Server: Search & Find Indexes By SchemaName, TableName, IndexName Or ColumnName Across Instances/DB’s

SQL Server: Delete In Chunks To Avoid Log Growth

Today, I had to perform a DELETE that happened to remove quite a bit of data. This caused two issues for me Log file growth which fills up the Transaction Log of the DB TempDB was getting full To avoid both problems I deleted in chunks. OPTION #1: DELETEing in Chunks is easier than you … Continue reading SQL Server: Delete In Chunks To Avoid Log Growth

SQL Server: Compare Database Tables/Indexes/Views/SP’s etc. For Differences Across Instances

There are a bunch of tools in the market to do the database comparisons for differences but if you want to do it for free (and programmatically)  at a basic level, you could use the method outlined below. For me, this came about as a result of an user asking "So, what is different between … Continue reading SQL Server: Compare Database Tables/Indexes/Views/SP’s etc. For Differences Across Instances