Troubleshooting Guide: Error 4846 — Bulk Data Provider Failed to Allocate Memory
Why This Error Happens
Error 4846 in SQL Server 2025 typically occurs when the BULK INSERT or OPENROWSET(BULK…) operation cannot secure enough contiguous memory from the OS or the SQL Server memory pool to process the incoming data stream. This is commonly caused by memory pressure from other applications on Windows Server 2025/Windows 11, an undersized “max server memory” configuration, or a corrupted/malformed source file causing the bulk provider to request abnormal buffer sizes. In some cases, outdated OLE DB bulk load drivers or insufficient virtual memory (page file) settings can also trigger this allocation failure.
Step-by-Step Resolution Guide
Step 1: Check and Adjust SQL Server Memory Configuration
- Open SQL Server Management Studio (SSMS) and connect to the instance.
- Run
EXEC sp_configure 'max server memory (MB)';to check the current cap. - Ensure at least 20-25% of physical RAM is reserved for the OS; adjust using
EXEC sp_configure 'max server memory (MB)', <value>; RECONFIGURE;. - Restart the SQL Server service via
services.mscornet stop MSSQLSERVER && net start MSSQLSERVER.
Step 2: Verify System-Level Virtual Memory and Resources
- Navigate to System Properties > Advanced > Performance Settings > Advanced > Virtual Memory on Windows Server 2025/Windows 11.
- Ensure the page file is set to “System managed size” or manually set to at least 1.5x physical RAM.
- Close unnecessary background services or applications consuming high memory (check via Task Manager > Performance tab).
- Reboot the server to clear fragmented memory if usage remains high after adjustments.
Step 3: Validate the Source File and Bulk Load Syntax
- Confirm the source file (CSV, TXT, etc.) is not corrupted by opening it in a text editor.
- Check for abnormally large row sizes or missing delimiters that could cause the provider to request excessive buffer allocation.
- Reduce the
BATCHSIZEandROWS_PER_BATCHparameters in yourBULK INSERTstatement, e.g.:
BULK INSERT dbo.TargetTable
FROM 'C:\Data\source.csv'
WITH (BATCHSIZE = 5000, TABLOCK);
Step 4: Update Drivers and Apply Latest Cumulative Update
- Go to Microsoft Update Catalog and download the latest Cumulative Update (CU) for SQL Server 2025.
- Update the OLE DB Driver for SQL Server to the latest version via the Microsoft Download Center.
- Reinstall the SQL Server Native Client or Microsoft OLE DB Driver if the bulk provider component appears outdated or missing.
Alternative or Verification Steps
- Re-run the exact
BULK INSERTorOPENROWSET(BULK...)command that previously failed; if successful without Error 4846, the fix is verified. - If the error persists, try importing the data in smaller chunks using SSIS (SQL Server Integration Services) instead of a direct T-SQL bulk command to bypass provider-level memory allocation limits.