Search code examples
sql-serverlinuxbcpxp-cmdshell

xp_cmdshell on SQL Server Linux Public Preview


I am using the Public Preview of SQL Server 2016 on Linux. I am trying to run xp_cmdshell and get the following error. I suspect it has to do with permissions but have no idea how to fix this. I have spent many hours searching for some answers but there seems to be little support for SQL Server on Linux. I am running this using an administrator account. SQL Server is installed on Ubuntu 16.4 (as recommended). I connect to it with Microsoft SQL Management Studio running on Windows 10.

SQL code:

EXEC xp_cmdshell @SQLtext, no_output

Error message:

Msg 15121, Level 16, State 21, Procedure xp_cmdshell, Line 1 [Batch Start Line 159] An error occurred during the execution of xp_cmdshell. A call to 'CreateProcess' failed with error code: '2'.


Solution

  • According to Microsoft's Release Notes for SQL Server 2017 General Availability, the following are currently not available on Linux:

    Database engine

    • Transactional replication
    • Merge replication
    • Stretch DB
    • Polybase
    • Distributed query with 3rd-party connections
    • System extended stored procedures (XP_CMDSHELL, etc.)
    • Filetable
    • CLR assemblies with the EXTERNAL_ACCESS or UNSAFE permission set
      Buffer Pool Extension

    SQL Server Agent

    • Subsystems: CmdExec, PowerShell, Queue Reader, SSIS, SSAS, SSRS
    • Alerts
    • Log Reader Agent
    • Change Data Capture
    • Managed Backup

    High Availability

    • Database mirroring

    Security

    • Extensible Key Management
    • AD Authentication for Linked Servers
    • AD Authenticatin for Availibility Groups (AGs)

    Services

    • SQL Server Browser
    • SQL Server R services
    • StreamInsight
    • Analysis Services
    • Reporting Services
    • Data Quality Services
    • Master Data Services

    Microsoft also has a list of Release notes and a list of unsupported features here.