Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.93 KB

sys-sp-flush-log-transact-sql.md

File metadata and controls

60 lines (43 loc) · 1.93 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sys.sp_flush_log (Transact-SQL)
Flushes to disk the transaction log of the current database, hardening all previously committed delayed durable transactions.
VanMSFT
vanto
randolphwest
07/06/2023
sql
system-objects
reference
sp_flush_log_TSQL
sys.sp_flush_log
sys.sp_flush_log_TSQL
sp_flush_log
sys.sp_flush_log
TSQL

sys.sp_flush_log (Transact-SQL)

[!INCLUDE sqlserver2016]

Flushes to disk the transaction log of the current database, thereby hardening all previously committed delayed durable transactions.

If you choose to use delayed transaction durability because of the performance benefits, but you also want to have a guaranteed limit on the amount of data that is lost on server crash or failover, then execute sys.sp_flush_log on a regular schedule. For example, if you want to make sure you don't lose more than n seconds worth of data, you would execute sp_flush_log every n seconds.

Executing sys.sp_flush_log guarantees that all previously committed delayed durable transactions are made durable. For more information, see Control Transaction Durability.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_flush_log
[ ; ]

Arguments

None.

Return code values

A return code of 1 indicates success. Any other value indicates failure.

Result set

None.

Sample code

EXEC sys.sp_flush_log;

Related content