Sql local database cannot be opened

限于喜欢 提交于 2019-12-18 18:51:55

问题


I recently installed VS2015 Update 2 on two different PC, one at home and one at work, with the same installer file.

Now if I open a project with Sql LocalDB on my own PC, I obtain this error:

The database 'M:\PROJECTS\BLOG\APP_DATA\myBlog.MDF' cannot be opened because it is version 851. This server supports version 782 and earlier. A downgrade path is not supported.

I cannot retrieve information about this 851 version (maybe Sql LocalDB 2016?). I'm sure to have Sql LocalDB 2016 RC0 on both PCs, and I verifies the settings in both VS2015 is:

(LocalDB)\MSSQLLocalDB

Does anyone know how to fix this?


回答1:


I had the same problem recently, I installed VS2015 Update 2, the same as your environment. Microsoft install MSSQL 2016 RC0 in this update... so there are two or more versions of LocalDB on your computer.

This problem is caused by having different versions of SqlLocalDB on your computers. You can solve this problem by changing the version of SqlLocalDB on one of your computers.

For example, change to version 851 (13.0)

  1. Open CMD , cd to folder of SqlLocalDB (Default : "C:\Program Files\Microsoft SQL Server\130\LocalDB\Binn")
  2. Command "SqlLocalDB.exe delete "MSSQLLocalDB"" , The instance of LocalDB will be deleted.
  3. Command "SqlLocalDB.exe create "MSSQLLocalDB"" , Then you'll see the instance of newest LocalDB version in your computer has been created.

How to use SqlLocalDB : https://msdn.microsoft.com/zh-tw/library/hh212961%28v=sql.120%29.aspx

Good luck!




回答2:


I had this same issue and error when trying to open a LocalDB. What fixed it for me was installing SQL Server 2014 LocaldB with Service Pack 1. I found the install in my MSDN subscriber downloads. During the install it asked to upgrade the old version and I said yes.




回答3:


mr kevin have given the key to solve this howver this is the commands that work with me

C:\Users\alawi>cd C:\Program Files\Microsoft SQL Server\130\Tools\Binn

C:\Program Files\Microsoft SQL Server\130\Tools\Binn>SqlLocalDB.exe delete MSSQLLocalDB LocalDB instance "mssqllocaldb" deleted.

C:\Program Files\Microsoft SQL Server\130\Tools\Binn>SqlLocalDB.exe create MSSQLLocalDB LocalDB instance "mssqllocaldb" created with version 13.0.1601.5.



来源:https://stackoverflow.com/questions/36699309/sql-local-database-cannot-be-opened

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!