Skip to content

Latest commit

 

History

History
90 lines (66 loc) · 4.66 KB

File metadata and controls

90 lines (66 loc) · 4.66 KB
title sys.dm_external_script_requests | Microsoft Docs
ms.custom
ms.date 06/24/2016
ms.prod sql
ms.reviewer
ms.suite sql
ms.technology
ms.tgt_pltfrm
ms.topic language-reference
f1_keywords
sys.dm_external_script_requests
sys.dm_external_script_requests_TSQL
dm_external_script_requests
dm_external_script_requests_TSQL
dev_langs
TSQL
helpviewer_keywords
sys.dm_external_script_requests dynamic management view
ms.assetid e7e7c50f-b8b2-403c-b8c8-1955da5636c3
caps.latest.revision 4
author stevestein
ms.author sstein
manager craigg

sys.dm_external_script_requests

[!INCLUDEtsql-appliesto-ss2016-xxxx-xxxx-xxx-md]

Returns a row for each active worker account that is running an external script.

Note

This DMV is available only if you have installed and then enabled the feature that supports external script execution. For information about how to do this for R scripts, see Set Up SQL Server R Services.

Column name Data type Description
external_script_request_id unique identifier ID of the process that sent the external script request. This corresponds to the process ID as received by [!INCLUDEssNoVersion_md]
language nvarchar Keyword that represents a supported script language. Currently only R is supported.
degree_of_parallelism int Number indicating the number of parallel processes that were created. This value might be different from the number of parallel processes that were requested.
external_user_name nvarchar The Windows worker account under which the script was executed.

Permissions

Requires VIEW SERVER STATE permission on server.

Note

Users who run external scripts must have the additional permission EXECUTE ANY EXTERNAL SCRIPT, however, this DMV can be used by administrators without this permission.

Remarks

This view can be filtered using the script language identifier.

The view also returns the worker account under which the script is being run. For information about worker accounts used by R scripts, see Modify the User Account Pool for R Services.

The GUID that is returned in the external_script_request_id field also represents the file name of the secured directory where temporary files are stored. Each worker account such as MSSQLSERVER01 represents a single SQL login or Windows user, and might be used to run multiple script requests. By default, these temporary files are cleaned up after completion of the requested script. If you need to preserve these files for some period for debugging purposes, you can change the cleanup flag as described in this topic: Configure and Manage Advanced Analytics Extensions.

This DMV monitors only active processes and cannot report on scripts that have already completed. If you need to track the duration of scripts, we recommend that you add timing information into your script and capture that as part of script execution.

Examples

Viewing the currently active R scripts for a particular process

The following example displays the number of external script executions being run on the current instance.

SELECT external_script_request_id 
  , [language]
  , degree_of_parallelism
  , external_user_name
FROM sys.dm_external_script_requests; 

Results

external_script_request_id language degree_of_parallelism external_user_name
183EE6FC-7399-4318-AA2E-7A6C68E435A8 R 1 MSSQLSERVER01

See Also

Dynamic Management Views and Functions (Transact-SQL)
Execution Related Dynamic Management Views and Functions (Transact-SQL)
sys.dm_external_script_execution_stats sp_execute_external_script