[英]How to point to correct data in a database
There are 2 Oracle databases with the same tables on two different servers. 在两个不同的服务器上有2个具有相同表的Oracle数据库。 Database A on server A and Database B on server B
服务器A上的数据库A和服务器B上的数据库B
A: Table1,Table2 A:表1,表2
B: Table1,Table2 B:表1,表2
These tables are identical to each other, in that it's possible to copy the data tables from server A to server B. We only have remote access to the database on Server A, but full admin access to Server B. 这些表彼此相同,因为可以将数据表从服务器A复制到服务器B。我们仅对服务器A上的数据库具有远程访问权限,但是对服务器B具有完全管理员访问权限。
So, database A is remote and has a primary and secondary DB. 因此,数据库A是远程的,并且具有主数据库和辅助数据库。 The secondary DB gets updated with the latest data, then we must switch the DB we're pointing to towards secondary.
用最新数据更新辅助数据库,然后我们必须将指向的数据库切换为辅助数据库。 Same for the opposite, when things are pointing to secondary, primary DB will get updated with data, then the system should point to Database A primary.
反之亦然,当事物指向辅助数据库时,主数据库将获得数据更新,然后系统应指向数据库A主数据库。 This way the database is never down we just switch what we point to after the other one gets updated.
这样,数据库永远不会关闭,我们只需在另一个数据库更新后切换指向的内容即可。
There is also a web interface that sets a config file whether we're pointing to the primary or the secondary DB 还有一个Web界面可以设置配置文件,无论我们指向主数据库还是辅助数据库
Now, I'm trying to come up with solutions on how to get/synchronize/copy/point to the correct database to get the updated data either directly from A or by copying data A to B. 现在,我正在尝试提出有关如何获取/同步/复制/指向正确数据库以直接从A或将数据A复制到B来获取更新数据的解决方案。
Solution 1) We read db config file and point directly to the primary (or secondary) DB 解决方案1)我们读取db配置文件并直接指向主(或辅助)数据库
Solution 2) Build a windows service that will detect when primary or secondary DB gets updated, and copy tables from DataBase A to DataBase B. 解决方案2)构建Windows服务,该服务将检测何时更新主数据库或辅助数据库,并将表从数据库A复制到数据库B。
Solution 3) Have a "copy tables" button on the web interface that will start a background task of copying data from A to B using http://hangfire.io 解决方案3)在Web界面上有一个“复制表”按钮,它将启动使用http://hangfire.io将数据从A复制到B的后台任务。
Solution 4) ?? 解决方案4)??
So far, I like the idea of solution 1 the best, where we just point directly to either the primary or secondary DB based on configuration. 到目前为止,我最喜欢解决方案1的想法,在这里我们只是直接基于配置指向主数据库或辅助数据库。 This idea doesn't involve any copying to the identical tables on Server B.
这个想法不涉及任何复制到服务器B上相同的表。
However, I was wondering if there is any other possible solution? 但是,我想知道是否还有其他可能的解决方案? Would triggers, replication, or something else work here?
触发器,复制或其他方法在这里有用吗?
Thanks. 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.