sp_cycle_errorlog (Transact-SQL)sp_cycle_errorlog (Transact-SQL)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions)

关闭当前的错误日志文件,并循环错误日志扩展编号(就像重新启动服务器)。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.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

  
sp_cycle_errorlog  

返回代码值Return Code Values

0 (成功) 或 1 (失败) 0 (success) or 1 (failure)

结果集Result Sets

None

备注Remarks

每次 SQL ServerSQL Server 启动时,当前错误日志都会重命名为 错误日志。 1; 错误日志 将变成 错误日志。 2错误日志 2 变成 错误日志。 3,依此类推。Every time SQL ServerSQL Server 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 使你能够在不停止和启动服务器的情况下循环错误日志文件。sp_cycle_errorlog enables you to cycle the error log files without stopping and starting the server.

权限Permissions

Sp_cycle_errorlog 的执行权限仅限于 sysadmin 固定服务器角色的成员。Execute permissions for sp_cycle_errorlog are restricted to members of the sysadmin fixed server role.

示例Examples

以下示例将循环 SQL ServerSQL Server 错误日志。The following example cycles the SQL ServerSQL Server error log.

EXEC sp_cycle_errorlog ;  
GO  

另请参阅See Also

系统存储过程 (Transact-SQL) System Stored Procedures (Transact-SQL)
sp_cycle_agent_errorlog (Transact-sql)sp_cycle_agent_errorlog (Transact-SQL)