Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 1.91 KB

sp-cycle-errorlog-transact-sql.md

File metadata and controls

66 lines (46 loc) · 1.91 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_cycle_errorlog (Transact-SQL)
sp_cycle_errorlog closes the current error log file and cycles the error log extension numbers just like a server restart.
markingmyname
maghan
randolphwest
07/05/2024
sql
system-objects
reference
sp_cycle_errorlog_TSQL
sp_cycle_errorlog
sp_cycle_errorlog
TSQL

sp_cycle_errorlog (Transact-SQL)

[!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

Syntax

sp_cycle_errorlog
[ ; ]

Arguments

None.

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

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.

Permissions

Execute permissions for sp_cycle_errorlog are restricted to members of the sysadmin fixed server role.

Examples

The following example cycles the [!INCLUDE ssNoVersion] error log.

EXEC sp_cycle_errorlog;
GO

Related content