- Viewing the SQL Server Error Log
- Просмотр журнала ошибок SQL Server Viewing the SQL Server Error Log
- Службы SCM. Настройка журналов ошибок SQL Server SCM Services — Configure SQL Server Error Logs
- Открытие диалогового окна «Настройка журналов ошибок SQL Server» To open the Configure SQL Server Error Logs dialog box
- Журнал ошибок агента SQL Server SQL Server Agent Error Log
- Просмотр журнала ошибок SQL Server в среде SQL Server Management Studio (SSMS) View the SQL Server error log in SQL Server Management Studio (SSMS)
- Просмотр журналов View the logs
Viewing the SQL Server Error Log
Applies to: SQL Server (all supported versions) — Windows only Azure SQL Managed Instance
View the SQL Server error log to ensure that processes have completed successfully (for example, backup and restore operations, batch commands, or other scripts and processes). This can be helpful to detect any current or potential problem areas, including automatic recovery messages (particularly if an instance of SQL Server has been stopped and restarted), kernel messages, or other server-level error messages.
View the SQL Server error log by using SQL Server Management Studio or any text editor. For more information about how to view the error log, see Open Log File Viewer. By default, the error log is located at Program Files\Microsoft SQL Server\MSSQL. n \MSSQL\LOG\ERRORLOG and ERRORLOG. n files.
A new error log is created each time an instance of SQL Server is started, although the sp_cycle_errorlog system stored procedure can be used to cycle the error log files without having to restart the instance of SQL Server. Typically, SQL Server retains backups of the previous six logs and gives the most recent log backup the extension .1, the second most recent the extension .2, and so on. The current error log has no extension.
Be aware that you can also view the SQL Server error log on instances of SQL Server that are offline or cannot start. For more information, see View Offline Log Files.
Просмотр журнала ошибок SQL Server Viewing the SQL Server Error Log
Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) — только Windows Управляемый экземпляр SQL Azure Azure SQL Managed Instance Управляемый экземпляр SQL Azure Azure SQL Managed Instance Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) — Windows only Управляемый экземпляр SQL Azure Azure SQL Managed Instance Управляемый экземпляр SQL Azure Azure SQL Managed Instance
Журнал ошибок сервера SQL Server SQL Server позволяет убедиться, что процессы были завершены успешно (например, операции резервного копирования и восстановления, пакеты команд или другие скрипты и процессы). View the SQL Server SQL Server error log to ensure that processes have completed successfully (for example, backup and restore operations, batch commands, or other scripts and processes). Это полезно при определении любых текущих или потенциальных проблем, включая сообщения автоматического восстановления (особенно если экземпляр SQL Server SQL Server был остановлен и перезапущен), сообщения ядра и другие сообщения об ошибках на уровне сервера. This can be helpful to detect any current or potential problem areas, including automatic recovery messages (particularly if an instance of SQL Server SQL Server has been stopped and restarted), kernel messages, or other server-level error messages.
Журнал ошибок сервера SQL Server SQL Server можно просмотреть, используя среду SQL Server Management Studio SQL Server Management Studio или любой текстовый редактор. View the SQL Server SQL Server error log by using SQL Server Management Studio SQL Server Management Studio or any text editor. Дополнительные сведения о просмотре журнала ошибок см. в разделе Open Log File Viewer. For more information about how to view the error log, see Open Log File Viewer. По умолчанию журнал ошибок содержится в файлах Program Files\Microsoft SQL Server\MSSQL. n \MSSQL\LOG\ERRORLOG и ERRORLOG. n . By default, the error log is located at Program Files\Microsoft SQL Server\MSSQL. n \MSSQL\LOG\ERRORLOG and ERRORLOG. n files.
Новый журнал ошибок создается при каждом запуске экземпляра сервера SQL Server SQL Server , хотя циклическую смену журнала ошибок можно организовать при помощи системной хранимой процедуры sp_cycle_errorlog без перезапуска экземпляра сервера SQL Server SQL Server . A new error log is created each time an instance of SQL Server SQL Server is started, although the sp_cycle_errorlog system stored procedure can be used to cycle the error log files without having to restart the instance of SQL Server SQL Server . Обычно сервер SQL Server SQL Server хранит резервные копии шести предыдущих журналов и присваивает наиболее свежей копии расширение «.1», следующей расширение «.2» и т. д. Typically, SQL Server SQL Server retains backups of the previous six logs and gives the most recent log backup the extension .1, the second most recent the extension .2, and so on. Файл текущего журнала ошибок расширения не имеет. The current error log has no extension.
Помните, что журнал ошибок SQL Server SQL Server можно также просматривать на экземплярах SQL Server SQL Server , которые находятся вне сети или не запускаются. Be aware that you can also view the SQL Server SQL Server error log on instances of SQL Server SQL Server that are offline or cannot start. Дополнительные сведения см. в разделе Просмотр автономных файлов журнала. For more information, see View Offline Log Files.
Службы SCM. Настройка журналов ошибок SQL Server SCM Services — Configure SQL Server Error Logs
Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions)
В этом разделе описано, как просмотреть и изменить способ очистки журналов ошибок SQL Server SQL Server . This topic describes how to view or modify the way SQL Server SQL Server error logs are recycled.
Открытие диалогового окна «Настройка журналов ошибок SQL Server» To open the Configure SQL Server Error Logs dialog box
В обозревателе объектов разверните экземпляр SQL Server, раскройте узел Управление, щелкните правой кнопкой мыши Журналы SQL Server, а затем выберите пункт Настройка. In Object Explorer, expand the instance of SQL Server, expand Management, right-click SQL Server Logs, and then click Configure.
В диалоговом окне Настройка журналов ошибок SQL Server выберите один из следующих параметров. In the Configure SQL Server Error Logs dialog box, choose from the following options.
а. a. Число файлов журнала Log files count
Ограничить количество файлов журнала ошибок перед очисткой Limit the number of the error log files before they are recycled
Установите этот флажок, чтобы ограничить количество файлов журнала ошибок, создаваемых до их очистки. Check to limit the number of error logs created before they are recycled. При каждом запуске экземпляра SQL Server SQL Server создается новый журнал ошибок. A new error log is created each time an instance of SQL Server SQL Server is started. SQL Server SQL Server сохраняет резервные копии шести предыдущих журналов, если этот флажок не установлен и ниже не указано иное максимальное число файлов журнала ошибок. retains backups of the previous six logs, unless you check this option, and specify a different maximum number of error log files below.
Максимальное количество файлов журналов ошибок Maximum number of error log files
Укажите максимальное количество архивированных файлов журнала ошибок, создаваемых до их очистки. Specify the maximum number of archived error log files created before they are recycled. Значение по умолчанию — 6, не включая текущий. The default is 6, not including the current one. Это значение определяет число предыдущих резервных копий журналов, которые SQL Server SQL Server хранит, прежде чем их очистить. This value determines the number of previous backup logs that SQL Server SQL Server retains before recycling them.
b. b. Размер файла журнала Log file size
Максимальный размер файла журнала ошибок в КБ Maximum size for error log file in KB
Можно задать размер каждого файла в килобайтах. You can set the size amount of each file in KB. Если оставить значение 0, размер журнала будет неограничен. If you leave it at 0 the log size is unlimited.
Журнал ошибок агента SQL Server SQL Server Agent Error Log
Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) Управляемый экземпляр SQL Azure Azure SQL Managed Instance Управляемый экземпляр SQL Azure Azure SQL Managed Instance Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) Управляемый экземпляр SQL Azure Azure SQL Managed Instance Управляемый экземпляр SQL Azure Azure SQL Managed Instance
В Управляемом экземпляре Azure SQL в настоящее время поддерживается большинство функций агента SQL Server (но не все). On Azure SQL Managed Instance, most, but not all SQL Server Agent features are currently supported. Подробные сведения см. в статье Различия в T-SQL между Управляемым экземпляром SQL Azure и SQL Server. See Azure SQL Managed Instance T-SQL differences from SQL Server for details.
SQL Server SQL Server Агент создает журнал ошибок, в который по умолчанию записываются предупреждения и ошибки. Agent creates an error log that records warnings and errors by default. В журнале отображаются следующие предупреждения и ошибки: The following warnings and errors are displayed in the log:
Предупреждающие сообщения, содержащие сведения о потенциальных проблемах, например «Задание удалено в процессе выполнения». Warning messages that provide information about potential problems, such as «Job was deleted while it was running.»
Сообщения об ошибках, обычно требующих вмешательства системного администратора, например «Невозможно начать почтовый сеанс». Error messages that usually require intervention by a system administrator, such as «Unable to start mail session.» Сообщения об ошибках могут отправляться конкретному пользователю или на конкретный компьютер с помощью команды net send. Error messages can be sent to a specific user or computer by net send.
SQL Server SQL Server поддерживает до девяти журналов ошибок агента SQL Server SQL Server . maintains up to nine SQL Server SQL Server Agent error logs. Каждый архивируемый журнал снабжается расширением, указывающим относительный срок давности журнала. Each archived log has an extension that indicates the relative age of the log. Например, расширение .1 указывает на новейший архивированный журнал ошибок, а расширение .9 — на наиболее старый. For example, an extension of .1 indicates the newest archived error log and an extension of .9 indicates the oldest archived error log.
По умолчанию сообщения трассировки выполнения не записываются в журнал ошибок агента SQL Server SQL Server , так как они могут его переполнить. By default, execution trace messages are not written to the SQL Server SQL Server Agent error log, because they can fill it. При заполнении журнала ошибок снижается возможность выбора и анализа более сложных ошибок. When the error log is full, your ability to select and analyze more difficult errors is reduced. Так как ведение журнала увеличивает нагрузку на сервер, важно правильно оценить эффект, получаемый при захвате сообщений трассировки выполнения в журнал ошибок. Because the log adds to the server’s processing load, it is important to consider carefully what value you obtain by capturing execution trace messages to the error log. В общем случае захват всех сообщений будет наилучшим вариантом только при отладке конкретной проблемы. Generally, it is best to capture all messages only when you are debugging a specific problem.
Когда агент SQL Server SQL Server остановлен, размещение журнала ошибок агента SQL Server SQL Server можно изменить. When SQL Server SQL Server Agent is stopped, you can modify the location of the SQL Server SQL Server Agent error log. Если журнал ошибок пустой, открыть его невозможно. When the error log is empty, the log cannot be opened. Журнал агента SQL Server SQL Server можно в любое время циклически перезаписывать без остановки агента SQL Server SQL Server с помощью dbo.sp_cycle_agent_errorlog. You can cycle the SQL Server SQL Server Agent log at any time without stopping SQL Server SQL Server Agent using dbo.sp_cycle_agent_errorlog.
Просмотр журнала ошибок агента SQL Server To view the SQL Server Agent error log
Переименование журнала ошибок агента SQL Server To rename a SQL Server Agent error log
Отправка сообщений об ошибках агента SQL Server To send SQL Server Agent error messages
Запись сообщений трассировки выполнения в журнал ошибок агента SQL Server To write execution trace messages to the SQL Server Agent error log
Просмотр журнала ошибок SQL Server в среде SQL Server Management Studio (SSMS) View the SQL Server error log in SQL Server Management Studio (SSMS)
Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions)
В журнал ошибок SQL Server SQL Server записываются пользовательские и определенные системные события, которые могут пригодиться при устранении неполадок. The SQL Server SQL Server error log contains user-defined events and certain system events you can use for troubleshooting.
Просмотр журналов View the logs
В среде SQL Server Management Studio выберите элемент Обозреватель объектов. In SQL Server Management Studio, select Object Explorer. Чтобы открыть обозреватель объектов, нажмите клавишу F8. To open Object Explorer, select F8. Либо в главном меню щелкните Вид и выберите пункт Обозреватель объектов: Or on the top menu, select View, and then select Object Explorer:
В обозревателе объектов подключитесь к экземпляру SQL Server и разверните его. In Object Explorer, connect to an instance of SQL Server, and then expand that instance.
Найдите и разверните раздел Управление (при условии, что у вас есть разрешения на его просмотр). Find and expand the Management section (assuming you have permissions to see it).
Щелкните элемент Журналы SQL Server правой кнопкой мыши, выберите пункт Вид, а затем журнал SQL Server. Right-click SQL Server Logs, select View, and then choose SQL Server Log.
Появится средство просмотра журнала (возможно, придется немного подождать) со списком журналов для просмотра. The Log File Viewer appears (it might take a moment) with a list of logs for you to view.