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

本主題適用於:是SQL Server (從 2008 開始)否Azure SQL Database否Azure SQL 資料倉儲 否平行處理資料倉儲 THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

關閉目前的錯誤記錄檔,依照類似伺服器重新啟動的方式來循環處理錯誤記錄副檔名的號碼。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 Server]SQL Server會啟動,目前的錯誤記錄檔已重新命名為errorlog.1;errorlog.1變成errorlog.2errorlog.2變成errorlog.3,依此類推。Every time [SQL Server]SQL 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.

PermissionsPermissions

執行權限sp_cycle_errorlog受限的成員為sysadmin固定的伺服器角色。Execute permissions for sp_cycle_errorlog are restricted to members of the sysadmin fixed server role.

範例Examples

下列範例會循環處理 [SQL Server]SQL Server 錯誤記錄檔。The following example cycles the [SQL Server]SQL 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)