C# sql server 2008 中的最大数据库数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1054016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maximum number of databases in sql server 2008
提问by Samuel
We are writing an ASP.Net/C# based program that will potentially be accessed by a number of companies (each having separate login and data). We are thinking of having multiple sql server 2008 databases (same instance), each for one company. However, the c# program that accesses the database will be the same and will create appropriate connection string based on the database the customer will be accessing.
我们正在编写一个基于 ASP.Net/C# 的程序,它可能会被许多公司访问(每个公司都有单独的登录名和数据)。我们正在考虑拥有多个 sql server 2008 数据库(同一实例),每个数据库用于一家公司。但是,访问数据库的 c# 程序将是相同的,并且会根据客户将访问的数据库创建适当的连接字符串。
How many such databases can be created in the single instance of the sql server before seeing any performance degradation due to:
在看到由于以下原因导致的任何性能下降之前,可以在 sql server 的单个实例中创建多少这样的数据库:
Limit on the connections, because each connection (not sure if it will be pooled for accessing different databases) is created using a differents connection string.
Limit on the number of databases, is it limited by the hardware or sql server 2008 will show degradation when the number of databases increases to say 100?
限制连接,因为每个连接(不确定它是否会被用于访问不同的数据库)是使用不同的连接字符串创建的。
数据库数量有限制,是硬件限制还是sql server 2008数据库数量增加到100时会出现降级?
Anything else I might be missing?
还有什么我可能会遗漏的吗?
Thanks for your time
谢谢你的时间
采纳答案by Mitch Wheat
- Max databases per SQL Server instance: 32,767
- Max User connections: 32,767
- 每个 SQL Server 实例的最大数据库数:32,767
- 最大用户连接数:32,767
(From here: Maximum Capacity Specifications for SQL Server)
(来自此处:SQL Server 的最大容量规范)
Both are practically limited by the amount of RAM the SQL server machine has, long before it reaches those maximum values.
两者实际上都受到 SQL 服务器机器拥有的 RAM 量的限制,远在达到这些最大值之前。
Of the two, I suspect user connections are going to be the bigger problem if you have thousands of users (as you are not using connection pooling).
在这两者中,如果您有数千个用户(因为您没有使用连接池),我怀疑用户连接将成为更大的问题。
To find the SQL Server machine's current value:
要查找 SQL Server 计算机的当前值:
SELECT @@MAX_CONNECTIONS AS 'Max Connections'
Updatedin response to poster's comments:
It's not really the number of databases that is the problem, but more the number of frequently accessed pages in those databases. If all the 'hot' pages fit into memory (and very few physical reads occur) then all is good.
针对发帖人的评论进行了更新:问题
并不是真正的数据库数量,而是这些数据库中经常访问的页面数量。如果所有“热”页面都适合内存(并且很少发生物理读取),那么一切都很好。
回答by Raj
Having multiple databases for multiple client could easily become a maintenance nightmare. If the application is the same, I am assuming that the DB design would be the same as well.
为多个客户端拥有多个数据库很容易成为维护的噩梦。如果应用程序相同,我假设 DB 设计也相同。
We did a similar project couple of years back, but we decided to go for commingling data in the same database and then developed a robust security model to make sure that one customer does not end up seeing or modifying another customer's data.
几年前我们做了一个类似的项目,但我们决定在同一个数据库中混合数据,然后开发了一个强大的安全模型,以确保一个客户最终不会看到或修改另一个客户的数据。
I can proudly say that the project was a success and today as we speak is holding data of 100+ different customers and is performing flawlessly.
我可以自豪地说,该项目取得了成功,今天,正如我们所说的,它持有 100 多个不同客户的数据,并且表现完美。
Raj
拉吉
回答by JP Alioto
You should also keep in mind that connections will be pooled by connection string -- in your case, you will get separate pools for each Customer DB. That might not be bad if you have high traffic for each customer, but if you have low traffic to lots of different databases you will not get the full benefit of pooling.
您还应该记住,连接将按连接字符串合并——在您的情况下,您将为每个客户数据库获得单独的池。如果每个客户的流量都很高,那可能还不错,但是如果许多不同数据库的流量很低,您将无法获得池的全部好处。