sys.sp_flush_log (Transact-SQL)
Applies to: SQL Server 2016 (13.x) and later versions
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.
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
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om