[英]SQL Server max databases number reached
I'm using SQL Server (LocalDB) in some unit tests. 我在一些单元测试中使用SQL Server(LocalDB)。 Every test attach a database to LocalDB.
每个测试都将数据库附加到LocalDB。 It's about 400 new databases per execution.
每次执行大约有400个新数据库。 I know, it's not the best approach.
我知道,这不是最好的方法。
After many days running testes I got: 运行睾丸多日后,我得到了:
System.Data.SqlClient.SqlException : Unable to create/attach any new database because the number of existing databases has reached the maximum number allowed: 32766.
I attach my MDF files with this connection string: 我用我的连接字符串附上我的MDF文件:
string.Format(@"Data Source=(LocalDB)\v11.0;AttachDbFilename={0}.mdf;Integrated Security=True", TempFile)
I tried detach all databases, but it didn't work. 我尝试分离所有数据库,但它没有用。 I used:
我用了:
EXEC sp_detach_db 'MyFile.MDF', 'true';
I also tried delete my LocalDB instance and didn't work too. 我也尝试删除我的LocalDB实例,但也没有用。 To delete I used:
删除我使用的:
Stop: 停止:
SqlLocalDB.exe stop "v11.0" -k
Delete: 删除:
SqlLocalDB.exe delete "v11.0"
Create: 创造:
SqlLocalDB.exe create "v11.0" -s
Any idea to solve this issue? 有什么想法解决这个问题吗?
您是否从创建它的相同用途中删除了LocaDB?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.