Sybase sql 在任何地方同步数据库视图(从统一拉到远程)?
我正在尝试设置一个同步模型,以将我的统一 Oracle 数据库与远程 SQL Anywhere 数据库同步。我有几个关于统一 Oracle 数据库的视图,我想将它们作为表拉入 Sql Anywhere 数据库。我想把它们拉过来,因为它们涉及 4-5 个表(必须喜欢良好的标准化),并且只有 7-8 列我需要读取访问权限(即我永远不会尝试更新它们。我只需要从合并的到远程数据库)。我该怎么做?
I am trying to set up a synchronization model to sync my consolidated Oracle database with a remote SQL Anywhere database. I have a couple Views on the consolidated Oracle database that I want to pull into the Sql Anywhere database as tables. I want to pull them over as they touch 4-5 tables (gotta love good normalization) and only have 7-8 columns that I need read access to (i.e. I will never try to update them. I just need to pull from the consolidated to the remote db). How do I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MobiLink 当然可以支持与视图同步,但这在同步模型中不受支持,因为视图没有主键(同步模型需要主键,如向导第一页所述),并且上载到视图需要可更新视图或“代替”触发器。
解决方法是临时定义一个与视图具有相同架构的表,并加上适当的主键定义。最简单的方法是对表使用相同的名称,但为此您需要使用不同的数据库。加载统一模式时选择该数据库/表,并将该表映射定义为仅下载。
然后您应该能够使用视图将该模型部署到 Oracle 数据库。如果必须对表使用与视图不同的名称,则应部署到文件并在生成的 SQL 文件中将表名称全局替换为视图名称。
MobiLink can certainly support synchronizing with views, but that isn't supported in synchronization models because views don't have primary keys (which sync models need, as outlined on the first page of the wizard), and uploading to views requires an updatable view or "instead of" triggers.
A workaround is to temporarily define a table with the same schema as the view, plus appropriate primary key definitions. It would be simplest to use the same name for the table, but for that you'd need to use a different database. Pick that database/table when loading the consolidated schema, and define that table mapping to be download only.
Then you should be able to deploy that model to the Oracle database with the view. If you had to use a different name for the table than for the view, you should deploy to file and globally replace the table name with the view name in the generated SQL file.