分离数据库 [英] Separating Database
问题描述
我确实从两个位置启用了两个数据库并启用了复制,但现在我们决定让这两个数据库完全相互分离。删除或禁用复制很容易,但我现在担心依赖这些
数据库的应用程序。与数据库B,表A相比,数据库A,表A将有一些额外的列。
我的问题是,我是否需要将我的应用程序分开,或者只是为每个数据库创建单独的类?
关注
Hi, I do have two databases from two locations with replication enabled but now we decided to have these two databases completely separated from each other. Removing or disabling replication is easy but I am now worried about the apps that depend on these
databases. Database A, table A will have some additional columns compared to Database B, table A.
My question is, do I need to separate my app as well or just create separate classes for each database?
Regards
推荐答案
您需要担心您的应用从TableName和非限定插入中执行select *,即
You need to worry about your app doing select * from TableName and unqualified inserts, ie
插入TableName
insert into TableName
从TableName2中选择*
select * from TableName2
像这样包含代码的应用程序将在您崩溃将其他列添加到基表。在某些情况下,您可以让应用程序使用看起来像原始表格的视图,并坐在新表格的顶部,并在其上添加其他列。这个
将涉及将表重命名为不同的表,并使用原始表名称查看。
An application with code in it like this will break when you add additional columns to the base tables. In some cases you can have the app use views which look like the original tables and sit on top of the new tables with additional columns on them. This will involve renaming the table to something different and having the view with the original table Name.
是
创建视图OriginalSchemaName .OriginalTableName
Create view OriginalSchemaName.OriginalTableName
as
select * from OriginalSchemaName.NewtableName
select * from OriginalSchemaName.NewtableName
这篇关于分离数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!