简体   繁体   English

创建多个数据库或一个

[英]Creating multiple databases or one

Our company has 4 business entities, so I have created 4 different databases for each company to be used for Human Resource service. 我们公司有4个业务实体,因此我为每个公司创建了4个不同的数据库,用于人力资源服务。 Let's call that as a Group, Company1, Company2, and Company3. 我们称之为集团,公司1,公司2和公司3。 Even though they are all different databases, tables and store procedures(SP) are almost same except Group. 尽管它们都是不同的数据库,但除了Group之外,表和存储过程(SP)几乎相同。 Group is a database that gets summarized data from each company. Group是一个数据库,可以从每个公司获取汇总数据。 I did create this way because of security purpose, but now it is kind of hard to manage. 出于安全目的,我确实创建了这种方式,但现在它很难管理。 When I change a SP for company1, then I have to do same thing for company2 and company3. 当我为company1更改SP时,我必须为company2和company3做同样的事情。 All 4 databases have same a employee master table,so when someone is added to companies, then that person has to be added to the employee table of Group DB by trigger or SP which I don't have to if they are in one table of a database. 所有4个数据库都有相同的员工主表,所以当有人被添加到公司时,那个人必须通过触发器或SP添加到组DB的员工表中,如果他们在一个表中,则不需要一个数据库。 by the way, I try not to use view at Group DB. 顺便说一句,我尽量不使用Group DB的视图。 I have to keep adding SP, trigger, and job into the database in order to communicate Group DB and other three company DBs. 我必须继续将SP,触发器和作业添加到数据库中,以便与Group DB和其他三个公司DB进行通信。

Now I have to create two more companies, so I have to consider this matter whether I have to keep creating same tables and SP again as a separate database or not. 现在我必须再创建两个公司,所以我必须考虑这个问题,我是否必须继续创建相同的表和SP作为单独的数据库。

What is your opinion for creating this types of database? 您对创建此类数据库有何看法? Would you prefer one DB for all companies or separated 4 databases? 您是否更喜欢所有公司的一个数据库或分开的4个数据库? Please, I'd like to share your opinion. 拜托,我想分享你的意见。 Thanks. 谢谢。

Put all the common stuff, including sps, in one db, then have a db for whatever is specific to each company. 将所有常见内容(包括sps)放在一个数据库中,然后为每个公司特定的内容设置数据库。 You should never have to update anything in more than one place. 您永远不必在多个地方更新任何内容。

You should put it all into one database. 你应该把它全部放在一个数据库中。 Reasons for that are numerous, but you already bumped into one - shared employees table... 原因很多,但你已经碰到了一个 - 共享员工表......

Security can be tailored so the specific groups of people can access specific tables, and so on. 可以定制安全性,以便特定人群可以访问特定表,等等。

Well, the road is long, take that first step :) 嗯,路很长,迈出第一步:)

You have some very strong cases for using a single database to store all the data. 您有一些非常强大的案例可以使用单个数据库来存储所有数据。 From your description it sounds like you could design it in a way which would make not only much of your deployment work easier, but also simplify any aggregate reporting which would happen across the group. 从您的描述中可以看出,您可以通过一种方式进行设计,这样不仅可以使您的部署工作更加轻松,还可以简化整个组中发生的任何聚合报告。

You'll have to weigh those benefits against your information security requirements. 您必须根据信息安全要求权衡这些好处。 I know in certain environments that separate databases are a necessity for security, dictated by law or company policy. 我知道在某些环境中,根据法律或公司政策,单独的数据库是安全的必要条件。 If you don't have any of those strict security requirements, I recommend the single database approach. 如果您没有任何严格的安全要求,我建议使用单一数据库方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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