SQL Server 2019 Out of memory error message - crash

Last weekend, we successfully migrated a SQL2016 AlwaysOnAG to a SQL 2019 AlwayOnAG. The new server has double the amount of memory (512GB), it's patched to CU12. OS is Windows Server 2019. Last night SQL crashed due to an "out of memory" error. As a result a failover took place. It looks like this error was caused by a rebuild of a columnstore index, because I saw a start of this action, but no completion time (we use the scripts from Ola Hallengren).
This index was already in the SQL2016 environment and no changes have been made since the migration (we're still in a "freeze"). Some things we are using: TDE, memory-optimized tempdb, in-memory tables, resource governor (disabled), polybase (but not used so far). Max memory for SQL is 448GB according to http://sqlmax.chuvash.eu/.
To me, an index rebuild should not result in this error. Any thoughts/ recommendations about this issue?

Related

Procedure stats getting cleared very often

Recent days, in our organisation, we are facing with a strange issue.
Our SQL Server has enough memory(256 GB) and CPU cores. There is no memory pressure(outcome of dm_os_sys_memory is "Available physical memory is high").
Only problem is, the procedure stats sys.dm_exec_procedure_stats is getting cleared very often. Stats doesn't stay even for an hour.
The reason why we need the stats is, it is being collected on daily basis with the help of the DMV dm_exec_procedure_stats. And, our SQL Developers used to do optimization on stored procedures, and once it is done, to know the effectiveness of the tuning activity, a comparison is being done between the collected historical stats and the current one.
Since, the procedure stats is not staying on the cache, we are not able to set any benchmark.
Kindly suggest some solutions.
Version: Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Enterprise Edition: (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: )
There are a number of ways that the cache can get cleared from Overall instance config changes to Db changes through to using recompile in procedures.
This link gives a good lead on what may be causing the issue but I think you are going to have to do some investigating.
https://www.sqlskills.com/blogs/glenn/eight-different-ways-to-clear-the-sql-server-plan-cache/

SSIS custom transformation component memory usage

I am moving large volumes of data from Oracle to SQL server on a daily basis. The application using the oracle system stores dates in non-standard formats and these need to be converted to SQL Server dates.
I have created a custom SSIS transformation components t odo this. My issue is that when running the SSIS packages consume a huge amount of memory, often reaching multiple gigabytes. The usage keeps ballooning while the package is running.
The issue is with the process "IISServerExec.exe" running on the server. When seen from the task manager the memory usage constantly increases while running. Several of these package need to run at the same time each day, but with this memory ballooning the system can only manage two or three.
I have also followed numerous online examples and they suffer the same problem. One example is the simple component from microsoft to convert a string to uppercase. This example consumed over 600mb of ram, with 6 input columns over 9 million rows.
If I create similar (but simpler) transformations using derived columns these consume less than 100mb of memory.
I am using SQL Server 2012 SP2 (11.0.5058) and have tested on four separate machines running Windows 7 and Server 2008 R2, each with all updates installed through windows update. All programming is done in VB on Visual Studio 2013. Oracle connection are using the Attunity source connector.
Is there a command you need to run at the end of the processInput section to flush out the ram or is memory usage expected?

Sql Server 2005 - cannot obtain a LOCK resource

The observed problem and error message is:
The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users.Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions
Environment: SQL Server 2005 Standard edition on Windows server 2003 Standard edition. Virtualized on a VM - with 8 GB RAM
Automatic applications are processing data - reading raw data and writing results to the database. These applications get the error message and they crash on it. (There are also database backup and index maintenance jobs scheduled.)
The same error was never observed on a similar system with sql server 2005 enterprise edition and windows 2003 enterprise edition.
I have already searched the web and found some answers. But e.g.
SQL Server cannot obtain a LOCK resource at this time - What to do?
was not helpful in my case
One source suggested to check:
SELECT request_session_id, COUNT (*) num_locks
FROM sys.dm_tran_locks
GROUP BY request_session_id
ORDER BY count (*) DESC
One session came up with 10.
The memory and lock settings are both in the default settings.
My current idea is to purge most of the data which is old and can be removed.
Does anybody have any other ideas how to deal with the lock resource problem? What exactly is its cause? Does SQL server standard edition allow less resources - is the problem related to the sql server version? How to fix the issue?
The autoshrink function had multiple locks on the database catalog.
The autoshrink also fragmented the primary key of a table after rebuilding the primary key.
Switching off the autoshrink function has solved the problem

MS Access Query Timeout When inserting row in SQL Backend

My users are receiving the query timeout error when they try to insert data to SQL server 2008 through an Access 2010 form. The error msg specifically occurs when users move off the record having keyed in all data fields.
When I look into Activity Monitor in SQL Server I can see many blocked SPIDs throughout the day but they do soon clear up. I don't know why this happens and the only solution seems to be restarting the SSMS Services. I don't think its a memory issue as the server has got 8GB which is plenty. The SQL DB is only 400 MB, but there are many transactions taking place across 2 sites.
I do notice that the SSMS memory consumption is around 3.5GB at the time of this error. After the restart this goes down of course.
Where do I start looking? is it network related or is it a blocked process due to local VBA code which could be moved to SQL Server? or is it cache related?
I'm no DBA so not sure of how to go about the search.
Thanks

SQL Server Express Casues CPU to Peg at 100% on Single Core Tablet

I am running an instance of SQL Server Express on an old underpowered tablet PC used for a special purpose application. Periodically the SQL Server process kicks in and hammers the CPU at 100% bringing the application to a halt. (Technically, it doesn't halt, it just slows it down to the point where key processes time-out.) It will be another two or three years before the hardware is replaced so that's not an option. Is there a way to throttle SQL Server Express?
There are a few techniques to identify CPU-hogging activity on MSSQL, but since your box is completely unresponsive at the time, you have few options. Using SQL Profiler to run a background trace logging to a table or file might be your best bet.
Until very recently, you needed a paid version of MSSQL to use Profiler, however MS now includes Profiler with MSSQL Express 2012 SP1. Here's a direct download link:
http://www.microsoft.com/en-us/download/details.aspx?id=35579
(Note, you can probably install Profiler without upgrading your MSSQL server instance, if you don't want to).
If you've never used Profiler to diagnose CPU-hogging queries before, here's how I would suggest going about it:
new trace > connect to your MSSQL instace
make sure the "CPU" column is selected
make sure both the "started" and "completed" events for all the queries (Statement/Query/Batch/Procedure/etc) are checked.
Use a "column filter" to only show events where there is a value in the "CPU" column
Select a name for the trace, and a destination (table or .TRN file)
Start the trace and leave it running
After experiencing the CPU issue, once your box recovers: open the trace results, paying particular attention to the CPU column, and the date/time the 100% utilization started. Here's a link with more about using Profiler to analyze traces:
http://msdn.microsoft.com/en-us/library/ms175848.aspx