Skip to content

Latest commit

 

History

History
70 lines (52 loc) · 2.8 KB

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

File metadata and controls

70 lines (52 loc) · 2.8 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_directory (Transact-SQL)
Specifies the directory where collected data is stored before it is uploaded to the management data warehouse.
markingmyname
maghan
randolphwest
07/04/2023
sql
system-objects
reference
sp_syscollector_set_cache_directory_TSQL
sp_syscollector_set_cache_directory
data collector [SQL Server], stored procedures
sp_syscollector_set_cache_directory stored procedure
TSQL

sp_syscollector_set_cache_directory (Transact-SQL)

[!INCLUDE SQL Server]

Specifies the directory where collected data is stored before it is uploaded to the management data warehouse.

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

Syntax

sp_syscollector_set_cache_directory [ [ @cache_directory = ] N'cache_directory' ]
[ ; ]

The directory in the file system where collected data is stored temporarily. @cache_directory is nvarchar(255), with a default of an empty string. If no value is specified, the default temporary [!INCLUDE ssNoVersion] directory is used.

Return code values

0 (success) or 1 (failure).

Remarks

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

The specified directory doesn't need to exist at the time the sp_syscollector_set_cache_directory is executed; however, data can't be successfully cached and uploaded until the directory is created. We recommend creating the directory before executing this stored procedure.

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, sets the cache directory for the data collector to D:\tempdata, and then enables the data collector.

USE msdb;
GO
EXECUTE dbo.sp_syscollector_disable_collector;
GO
EXEC dbo.sp_syscollector_set_cache_directory
    @cache_directory = N'D:\tempdata';
GO
EXECUTE dbo.sp_syscollector_enable_collector;
GO

Related content