Troubleshooting BULK INSERT and OPENROWSET issues on Azure SQL Database

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

Azure SQL Database (single database and Managed Instance) enables you to load files from Azure Blob Storage. If you experience some issue while you are loading files from Azure blob storage, here you can find the actions that can help you to troubleshoot and mitigate the issue.

 

  • If you are noticing that some syntax error is returned by BULK INSERT or BULK INSERTcheck are you using supported syntax in this statement. As an example, if you are trying to load data via network share path note that this option is not supported in Managed Instance.
  • Make sure that you are restoring a database from public blob storage protected with SAS credential. Private IPs for blob storage and service endpoints are currently not supported.
  • If you are getting the error 5 (Access Denied), make sure that you have not denied the access to your Azure Blob Storage account using the firewall:Storage firewall.png

 

  • Verify that you have created EXTERNAL DATA SOURCE with type BLOB_STORAGE targeting the URL of the blob storage where you placed the files that should be restored to your database.
  • Make sure that you are targeting existing file on Azure blob storage.
  • Script CREDENTIAL to SQL Server 2017 and try to load the files. If you are troubleshooting the issue on Managed Instance make sure that SQL Server is in the subnet that is within the same VNet as the Managed Instance, 
  • Check is your SAS credential placed in SECRET option of CREATE DATABASE SCOPED CREDENTIAL statement valid. The most common errors in SAS token parameters are:
    • ? is not removed from the beginning of the SAS token because the Azure portal generates SAS token with the leading ?. Remove this character if you see it.
    • se (expiry date) property is set to some value in the past (note that this is UTC time).
    • st (start date) property is not in the past (note that this is UTC time).
    • sp (permission) property should allow reading the file on the storage account.
    • sip (ip rage) remove this parameter if it is present in SAS token..

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.