2个服务器orcale具有相同的数据库 [英] 2 server orcale have the same database

查看:92
本文介绍了2个服务器orcale具有相同的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有2个orcale服务器:
1- ser1有数据库1
2- ser2有数据库2

* datebase1和daabase2是相同的

我需要使用相同的语句在database1中插入,删除或更新动态地作用于database2中

在此先感谢

hi all

i have 2 orcale server :
1- ser1 have database1
2- ser2 have database2

* datebase1 and daabase2 is the same

i need when i insert , delete or update in database1 dynamically effect in database2 with the same statement

thanks in advance

推荐答案

有几种选择.一种非常简单的方法是在数据库之间创建数据库链接.请参阅: http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_5005.htm [ ^ ]

使用该链接,您可以针对远程服务器执行语句,例如从源服务器中的触发器执行语句.

如果要查找将远程服务器用作备份服务器的解决方案,请查看备用解决方案:
There are several options for this. One quite easy way is that you create a database link between the databases. See: http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_5005.htm[^]

Using that link you can execute statements against the remote server for example from a trigger in the source server.

If you''re looking for a solution where the remote server acts as a backup server, then have a look at standby solutions: http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/create_ps.htm[^]

[Addition based on comment]
You can create two separate connection objects and execute necessary statements against both connections.

However, if you plan to do the exact same things on both server I believe that this will only succeed generally if there''s 1 and only 1 user in both databases at the same time. If they are multi-user databases another application may interfere the logic in the middle of an operation and the results may vary among those databases.

Another thing is that what''s going to happen if you execute DML operation against database 1 and then against database 2. What if the second operation isn''t succeeding? By definition you should roll back the first operation also but can you do this reliably from the client application. Typically a distributed transaction is used in these kind of cases.


这篇关于2个服务器orcale具有相同的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆