| title | sp_cycle_errorlog (Transact-SQL) | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/14/2017 | ||
| ms.prod | sql-non-specified | ||
| ms.reviewer | |||
| ms.suite | |||
| ms.technology |
|
||
| ms.tgt_pltfrm | |||
| ms.topic | language-reference | ||
| f1_keywords |
|
||
| dev_langs |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | 61a12cbf-78a3-4052-8604-3b29d07573fd | ||
| caps.latest.revision | 31 | ||
| author | JennieHubbard | ||
| ms.author | jhubbard | ||
| manager | jhubbard |
[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx_md]
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 has been created.
| Applies to: [!INCLUDEssNoVersion] ([!INCLUDEssKatmai] through current version). |
Transact-SQL Syntax Conventions
sp_cycle_errorlog
0 (success) or 1 (failure)
None
Every time [!INCLUDEssNoVersion] 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 [!INCLUDEssNoVersion] error log.
EXEC sp_cycle_errorlog ;
GO
System Stored Procedures (Transact-SQL)
sp_cycle_agent_errorlog (Transact-SQL)