Search code examples
vagrantssmsubuntu-16.04database-restoresql-server-vnext

Cannot restore a database with SSMS 2017 over MSSQL vNext Ubuntu 16.04


I've just installed the last version of Sql Server Management Studio 2017 (v17.0) in order to connect to the brand new SQL SERVER vNEXT on Ubuntu 16.04.

So, I tried to restore the classic NORTHWND database, just to test the environment, but the system returned an error.

Although I was using sa login the system gave to me an access permission error to the folder /var/opt/mssql/data/ (where the .bak file reside).

The error message was: Cannot access the specified path or file on the server. Verify that you have the necessary security privileges and that the path or file exists.

I've already check the access of that folder, and it is set correctly to the user mssql, infact if I use SSMS 2014, with the same login, I can restore that database without any problem.

I'm wondering if it isn't a bug of SSMS 2017 after all.

Btw, my configuration is:

the server:

  • Ubuntu 16.04 virtualized with Vagrant + VirtuaBox
  • Sql Server vNext

the client:

  • Windows 7 SP1
  • SSMS 2017 (v17.0 build 14.0.17099.0) (doesn't work)
  • SSMS 2014 (it works!)

Thanks for helping!


Solution

  • Seems still not possible restore a database through the UI. But, partially using the UI, I taken in place this old fashioned workaround:

    • Open SSMS 2017 and connect to the database
    • Open a New Query window
    • Before to procede locate your .bak file into the machine
    • Run this command to get the list of database and log files from your .bak file, in my env was: RESTORE FILELISTONLY FROM DISK = '/var/opt/mssql/backup/Northwind.bak'
    • Write down the database name, database filename, log filename and their logical names for using in the next step

    • Run this command to restore the database RESTORE DATABASE NORTHWND FROM DISK = '/var/opt/mssql/backup/Northwind.bak' WITH MOVE 'Northwind' TO '/var/opt/mssql/data/NORTHWND.mdf', MOVE 'Northwind_Log' TO '/var/opt/mssql/data/NORTHWND_Log.ldf' GO

    • Et voilà, the database was successfully restored!

    • So, be sure to use the right names before running the RESTORE DATABASE.

    I keep deeping to find the right solution, for the moment this is enough for me.