Skip to content

Latest commit

 

History

History
76 lines (56 loc) · 2.69 KB

sp-syscollector-set-cache-window-transact-sql.md

File metadata and controls

76 lines (56 loc) · 2.69 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_syscollector_set_cache_window (Transact-SQL)
Sets the number of times to attempt a data upload if a failure occurs.
markingmyname
maghan
randolphwest
08/21/2024
sql
system-objects
reference
sp_syscollector_set_cache_window
sp_syscollector_set_cache_window_TSQL
sp_syscollector_set_cache_window stored procedure
data collector [SQL Server], stored procedures
TSQL

sp_syscollector_set_cache_window (Transact-SQL)

[!INCLUDE SQL Server]

Sets the number of times to attempt a data upload if a failure occurs. Retrying an upload in the event of a failure mitigates the risk of losing collected data.

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

Syntax

sp_syscollector_set_cache_window [ [ @cache_window = ] cache_window ]
[ ; ]

Arguments

[ @cache_window = ] cache_window

The number of times a failed data upload to the management data warehouse is retried without losing data. @cache_window is int, with a default of 1. @cache_window can have one of the following values:

Value Description
-1 Cache all the upload data from the previous upload failures.
0 Don't cache any data from an upload failure.
n Cache data from n previous upload failures, where n >= 1.

Return code values

0 (success) or 1 (failure).

Remarks

You must disable the data collector before changing the cache window configuration. This stored procedure fails if the data collector is enabled. For more information, see Enable or disable data collection, and Manage data collection.

Permissions

Requires membership in the dc_admin (with EXECUTE permission) fixed database role to execute this procedure.

Examples

The following example disables the data collector, configures the cache window to retain data for up to three failed uploads, and then enables to data collector.

USE msdb;
GO
EXECUTE dbo.sp_syscollector_disable_collector;
GO
EXECUTE dbo.sp_syscollector_set_cache_window 3;
GO
EXECUTE dbo.sp_syscollector_enable_collector;

Related content