Skip to content

Latest commit

 

History

History
84 lines (62 loc) · 4.44 KB

File metadata and controls

84 lines (62 loc) · 4.44 KB
title sys.dm_external_script_requests | Microsoft Docs
ms.custom
ms.date 10/28/2018
ms.prod sql
ms.reviewer
ms.technology
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
author stevestein
ms.author sstein

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 dynamic management view (DMV) is available only if you have installed and enabled the feature that supports external script execution. For more information, see R Services in SQL Server 2016 and Machine Learning Services (R, Python) in SQL Server 2017 and later.

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.
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 the external scripts, see the Identities used in processing (SQLRUserGroup) section in Security overview for the extensibility framework in SQL Server Machine Learning 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.

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