与新数据库设计并行维护数据库遗留表数据
我目前正在开展一个项目,最终目标是将遗留系统转换为真正的 N 层架构。该项目的初始部分涉及将底层数据库转换为真正的关系设计。
底层数据库当前运行在IBM iSeries 上。这些表是使用 DDS 定义的,包含大量冗余数据、没有完整性检查和设计不当的键等。基本上将它们重构为完全规范化的设计是不可能的。
新桌子将从头开始设计。它们也将位于相同的 iSeries 上,但将使用 DDL 进行定义。这还涉及重写整个应用程序中的任何插入或更新代码以利用新表。然而,有大量负责报告、显示等的遗留应用程序此时不会被重写,并且仍将从原始表中读取。因此,我们需要使旧表中的数据与新表数据保持同步。我想知道是否有人做过类似的事情或有什么建议?我目前正在考虑:
1)从新表 A 插入、更新、删除的存储过程也会对匹配旧表 B 执行相同的操作。在未来的某个时刻,需要修改存储过程以停止同步表B
2) 将触发器放在表 A 上,该触发器也会修改表 B。然后触发器将被删除...存储过程不需要更改,但这仍然可以与事务管理一起正常工作吗?
3) 删除旧表 B 并将其重新创建为表 A 上的视图。不确定这是否有效,因为表 B 适用于键控访问,并且我相信视图不支持此操作?
有兴趣听听任何人的想法吗?
干杯
I am currently working on a project with the final aim of converting a legacy system to a true N-Layer architecture. The initial part of the project involves converting the underlying database to a true relational design.
The underlying database is currently running on the IBM iSeries. The tables are defined using DDS and contain mountains of redundant data, no integrity checking and poorly designed keys etc. Basically refactoring them to a fully normalized design is a non-starter.
New tables are going to be designed from scratch. They will also be on the same iSeries but will be defined with DDL. This will also involve re-writing any insert or update code throughout the application to utilise the new tables. There is however a large amount of legacy apps responsible for reports, displays etc that will not be re-written at this point and will still be reading from the original tables. So we need to keep the data in old, legacy tables in sync with new table data. I was wondering if anyone had ever done something similar or had any suggestions? I am currently thinking either:
1) The stored procedures that inserts, updates, deletes from new table A will also do the same to matching legacy table B. At some point down the line the stored procedure will need to be modified to stop syncing table B
2) Place triggers on table A that also modifies table B. Then the triggers will be removed down the line... the stored procedure don't need to be changed but will this still work fine with transaction management?
3) Remove legacy table B and recreate it as view on table A. Not sure if this will work as table B works on keyed access and I believe views don't support this?
Would be interested to hear anyone's thoughts?
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我喜欢第三点。我假设您将运行一些转换过程,该过程将从旧表 B 中获取现有数据并将其放入新表 A 中(或更可能是一组新表,因为听起来旧表 B 已非规范化) )。
如果您负责报告、显示等的遗留应用程序不需要进行任何更新,那么使用视图是理想的情况。我认为保留两个单独的数据副本(一份标准化,一份非标准化)会让人头疼,尤其是当经理的 TPS 报告与他在新系统中输入的内容不匹配时。至少只有一份数据副本,您不必担心在两个地方执行数据修复。
I favour number 3. I assume that you would run some conversion process that would take the existing data from legacy table B and put it into new table A (or more likely, a set of new tables since it sounds like legacy table B is denormalized).
If your legacy apps responsible for reports, displays etc don't need to do any updates then using views is the ideal situation. I think keeping two separate copies of data (one normalized, one denormalized) would turn into a headache, especially when the manager's TPS reports don't match what he entered in the new system. At least with only one copy of the data, you don't have to worry about performing data fixes in two places.