По неуважності встановив 200MB в Maximum Server Memory (in MB) (через Microsoft SQL Server Management Studio- Server Properties-Memory).
Після цього неможливо підключитись до сервера, намагання запустити MSSMS, щоб виправити помилку теж не вдаються.
Рішення, що пропонує ШІ не зовсім так працює.
Працюючій варіант:
1. Запустити SQL Server Configuration Manager. Вибрати "SQL Server Services", а на панелі справа вибрати "SQL Server (MSSQLSERVER)" , потім Properties і в закладці "Startup Parameters" tab and додати "-f". Потім перезапустити сервер прямо в SQL Server Configuration Manager.
2. Потім через консоль запустити sqlcmd -S 127.0.0.1 (якщо використовується Windows Authentication) у режимі Dedicated Administrator Connection (DAC). Після підключення вказати T-SQL команду щоб встановити наприклад 4GB достатні для підключення:
Після цього неможливо підключитись до сервера, намагання запустити MSSMS, щоб виправити помилку теж не вдаються.
Рішення, що пропонує ШІ не зовсім так працює.
Працюючій варіант:
1. Запустити SQL Server Configuration Manager. Вибрати "SQL Server Services", а на панелі справа вибрати "SQL Server (MSSQLSERVER)" , потім Properties і в закладці "Startup Parameters" tab and додати "-f". Потім перезапустити сервер прямо в SQL Server Configuration Manager.
2. Потім через консоль запустити sqlcmd -S 127.0.0.1 (якщо використовується Windows Authentication) у режимі Dedicated Administrator Connection (DAC). Після підключення вказати T-SQL команду щоб встановити наприклад 4GB достатні для підключення:
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'max server memory', 4096;
GO
RECONFIGURE;
GO
3. Вийти з sqlcmd через exit. Прибрати параметр "-f" через SQL Server Configuration Manager. Перезапустити сервер і спробувати підключитись.
3. Вийти з sqlcmd через exit. Прибрати параметр "-f" через SQL Server Configuration Manager. Перезапустити сервер і спробувати підключитись.
Пораду знайшов тут
https://dba.stackexchange.com/questions/40481/accidentally-turned-down-sql-memory-too-low-to-log-in-how-do-i-fix
І порада від ШІ:
If SQL Server is configured with a memory limit so low that it prevents connections, the following methods can be used to regain access and adjust the
max server memory
setting:1. Use the Dedicated Administrator Connection (DAC):
The DAC allows a single, dedicated connection to SQL Server even when the server is under severe resource pressure.
- Open SQL Server Management Studio (SSMS).
- When connecting, prefix the server name with
ADMIN:
(e.g.,ADMIN:YourServerName
). - Once connected, execute the following Transact-SQL (T-SQL) commands to increase the
max server memory
:
2. Modify Startup Parameters via SQL Server Configuration Manager:
This method involves starting SQL Server in a minimal configuration to allow access for memory adjustments.
- Open SQL Server Configuration Manager.
- Navigate to "SQL Server Services" and right-click on your SQL Server instance (e.g., "SQL Server (MSSQLSERVER)").
- Select "Properties" and go to the "Startup Parameters" tab.
- Add the
-f
parameter to the startup parameters. This starts SQL Server in single-user mode with minimal configuration. - Restart the SQL Server service.
- Connect to SQL Server using SSMS (standard connection or DAC) and adjust the
max server memory
as shown in the DAC method above. - Remove the
-f
parameter from the startup parameters and restart the SQL Server service again to return to normal operation.
3. Use
sqlcmd
with the -f
parameter:This command-line approach provides an alternative when SSMS connections are not possible.
- Stop the SQL Server service.
- Open a command prompt and navigate to the directory of
sqlservr.exe
. - Start SQL Server in minimal configuration using:
- Open another command prompt and connect using
sqlcmd
:
- Execute the T-SQL commands to adjust
max server memory
as shown in the DAC method. - Stop the
sqlservr.exe
process from the first command prompt. - Restart the SQL Server service normally.
Important Considerations:
- When adjusting
max server memory
, ensure it is set to a value that allows SQL Server to function efficiently without consuming all available system memory, leaving enough for the operating system and other applications. A common recommendation is to reserve 1-2 GB for the OS and then allocate the remaining memory to SQL Server. - The DAC is a crucial tool for troubleshooting low memory situations and should be used with caution as it bypasses some security checks.
- Review the SQL Server error logs for messages related to memory pressure (e.g., errors 701, 802, 1204) to understand the extent of the memory issues.
Коментарі
Дописати коментар