简体   繁体   中英

Managing multiple databases

We have done a project with around 20 tables in SQL Server, and a completed an ASP.NET project.

Recently our client told us about a new parameter called Site . As he says there are multiple sites for a project data in Application have to be different for each site. We are facing some issues now since the application is completely developed we can not update every SQL Server table and every SQL query related to Application to change according to the site parameter now we are discussing to have multiple databases for each site.

Things get worse because client says there can be around 20 sites per project. So for us it'll be very hard to manage 20 databases.

Can some one please tell us a appropriate solution for this issue?

The solution you have suggested would appear to be the correct one; use a different database per site (note: a database server can host all 20 databases easily depending on the transaction volume).

Explanation: What you need is to separate the data per site; this can either be done by adding a site identifier to the tabular data or by making sure sites do not share a datastore; the latter is in this case the easiest and most cost effective solution.

Note that "maintaining a database" is not as hard as you make it sound; in my opinion the volume of the data and transactions to manage and the number of manual corrections to make are the key factors in cost of maintenance...

I've been down this road in the past before and what we did was created a Site table, and then the objects that a site owned, we added a foreign key relationship back to the Site table.

In our case we only had three or four objects that a site owned, so we only had to modify 4 tables. Then the relationship from there down would still work and no modifications would be needed.

I would not go the route of a database per site, it will become a maintenance nightmare if you have to make database changes in the future or if you want to pull reports across the system as a whole

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM