Skip to content

Latest commit

 

History

History
99 lines (66 loc) · 4.1 KB

dbcc-dropcleanbuffers-transact-sql.md

File metadata and controls

99 lines (66 loc) · 4.1 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
DBCC DROPCLEANBUFFERS (Transact-SQL)
DBCC DROPCLEANBUFFERS removes all clean buffers from the buffer pool, and columnstore objects from the columnstore object pool.
rwestMSFT
randolphwest
03/23/2023
sql
t-sql
reference
DROPCLEANBUFFERS
DBCC_DROPCLEANBUFFERS_TSQL
DROPCLEANBUFFERS_TSQL
DBCC DROPCLEANBUFFERS
clean buffers
cold buffer cache
buffer pools [SQL Server]
dropping buffers
removing buffers
DBCC DROPCLEANBUFFERS statement
TSQL
>=aps-pdw-2016||=azure-sqldw-latest||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

DBCC DROPCLEANBUFFERS (Transact-SQL)

[!INCLUDE sql-asdb-asdbmi-asa-pdw]

Removes all clean buffers from the buffer pool, and columnstore objects from the columnstore object pool.

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

Syntax

Syntax for [!INCLUDEssNoVersion], [!INCLUDE ssazure-sqldb], and [!INCLUDEssSOD]:

DBCC DROPCLEANBUFFERS [ WITH NO_INFOMSGS ]

Syntax for [!INCLUDEssazuresynapse-md] and [!INCLUDEssPDW]:

DBCC DROPCLEANBUFFERS ( COMPUTE | ALL ) [ WITH NO_INFOMSGS ]

Arguments

WITH NO_INFOMSGS

Suppresses all informational messages. Informational messages are always suppressed on [!INCLUDEssazuresynapse-md] and [!INCLUDEssPDW].

COMPUTE

Purge the data cache in memory from each Compute node.

ALL

Purge the data cache in memory from each Compute node and from the Control node. This setting is the default if you don't specify a value.

Remarks

Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server. To drop clean buffers from the buffer pool and columnstore objects from the columnstore object pool, first use CHECKPOINT to produce a cold buffer cache. CHECKPOINT forces all dirty pages for the current database to be written to disk and cleans the buffers. After you checkpoint the database, you can issue DBCC DROPCLEANBUFFERS command to remove all buffers from the buffer pool.

In Azure SQL Database, DBCC DROPCLEANBUFFERS acts on the database engine instance hosting the current database or elastic pool. Executing DBCC DROPCLEANBUFFERS in a user database drops clean buffers for that database. If the database is in an elastic pool, it also drops clean buffers in all other databases in that elastic pool. Executing the command in the master database has no effect on other databases on the same logical server. Executing this command in a database using Basic, S0, or S1 service objective may drop clean buffers in other databases using these service objectives on the same logical server.

Result sets

DBCC DROPCLEANBUFFERS on [!INCLUDEssNoVersion] returns:

DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Permissions

Applies to: SQL Server, [!INCLUDEssPDW]

  • Requires sysadmin permission on the server

Applies to: SQL Server 2022 and later

  • Requires ALTER SERVER STATE permission on the server

Applies to: [!INCLUDE ssazure-sqldb]

  • Requires membership in server role ##MS_ServerStateManager##

Applies to: [!INCLUDEssazuresynapse-md]

  • Requires membership in the db_owner fixed server role

See also