| title | sp_cycle_errorlog (Transact-SQL) | ||
|---|---|---|---|
| description | sp_cycle_errorlog closes the current error log file and cycles the error log extension numbers just like a server restart. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Closes the current error log file and cycles the error log extension numbers just like a server restart. The new error log contains version and copyright information and a line indicating that the new log was created.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_cycle_errorlog
[ ; ]
None.
0 (success) or 1 (failure).
None.
Every time [!INCLUDE ssNoVersion] is started, the current error log is renamed to errorlog.1; errorlog.1 becomes errorlog.2, errorlog.2 becomes errorlog.3, and so on. sp_cycle_errorlog enables you to cycle the error log files without stopping and starting the server.
Execute permissions for sp_cycle_errorlog are restricted to members of the sysadmin fixed server role.
The following example cycles the [!INCLUDE ssNoVersion] error log.
EXECUTE sp_cycle_errorlog;
GO