Blog Post

Azure Database Support Blog
1 MIN READ

Lesson Learned #281: Export fails due to system out of memory exception

Jose_Manuel_Jurado's avatar
Jan 13, 2023

We found today an out of memory exception raised by SQL Server Management Studio exporting a database. This exception may occurs because, for performance improvement the export process, this process uses memory to extract schema model and depending how large is your schema objects definition, for example, how many tables, contraints, indexes, etc.. you could reach this error message. 

 

To avoid this specific exception, using the parameter /p:Storage=File with SqlPackage redirect the backing storage for the schema model used during extraction to storage instead of memory. Use the following command line to include /p:Storage=File - sqlpackage.exe /Action:Export /ssn:tcp:<ServerName>.database.windows.net,1433 /sdn:<DatabaseName> /su:<UserName> /sp:<Password> /tf:<TargetFile> /p:Storage=File

 

Also, you could find more information here

 

Enjoy!

Updated Jan 13, 2023
Version 2.0
  • tscamell-vt's avatar
    tscamell-vt
    Copper Contributor

    Thanks for sharing! I'm hoping this fixes my issue 🙂

     

    Please note, the /p:Storage parameter is not supported in the .NET Core (.NET 6) SQLPackage implementations as file-backed models use Esent which would only work on Windows. If you try and use the .NET 6 implementation this will result in the error:

     

    *** An unexpected failure occurred: .NET Core should not be using a file backed model..

     

    The current workaround is to use the .NET Framework build instead, where the parameter is supported.