我可以将多个 SQL 数据库迁移到单个 Babelfish 实例中并为不同的用户隔离吗?
我正在将多个 SQL DB(例如 A 和 B)迁移到单个 Babelfish 实例。
我有包含表 x、y 和 z 的 SQL 实例 A,以及包含表 x、y 和 z 的实例 B。
我希望 Babelfish 有某种方法让它们以 Ax、Ay、Az、Bx、By 和 Bz 的形式共存。
最初的想法是给表名添加前缀(所以 A_x、A_y 等),但由于应用程序的更改,这是站不住脚的必需的,所以我需要某种方法使其对应用程序透明,只要连接指向 A 或在开始时执行“USE A”即可。
I am migrating multiple SQL DBs (say A and B) to a single Babelfish instance.
I have SQL instance A with tables x, y and z and instance B with tables x, y and z.
I want Babelfish to have some way to have them coexist as A.x, A.y, A.z, B.x, B.y and B.z.
The original idea was to prefix the table names (so A_x, A_y, etc.) but this is untenable because of the app changes required, so I need some way to make it transparent to the application as long as the connection points to A or does a "USE A" at the start.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Babelfish 允许您迁移数据库 A 和 B,同时保留 SQL Server 数据库结构以及引用 A.dbo.x、B.dbo.x 等(请注意,具有 3 部分对象名称的跨数据库查询尚不支持)目前在当前数据库之外受支持,但这些正在开发中)。当您运行“USE A”然后执行“SELECT * FROM x”时,您将触摸 A.dbo.x。当您首先执行“USE B”时,您将触摸 B.dbo.x。
因此,当您针对 Babelfish 运行 DDL 创建数据库 A 和 B 时,您将获得与 SQL Server 中的基本相同的结果,并且无需更改任何语法(同样,假设当前不需要跨数据库查询) )。
现在,如果您的问题是如何将数据库 A 和 B 合并到单个数据库中,那么这与在 SQL Server 本身中执行此操作的方式没有什么不同。在这种情况下,我建议在 SQL Server 中实际执行合并,然后对生成的 SQL Server 数据库进行逆向工程,并针对 Babelfish 运行该脚本以重新创建该数据库。
Babelfish lets you migrate databases A and B while retaining the SQL server database structure as well as the references A.dbo.x, B.dbo.x , etc. (note that cross-DB queries with 3-part object names are not yet currently supported outside the current database, but these are in the works). When you run "USE A" and then do "SELECT * FROM x", you'll touch A.dbo.x. When you do "USE B" first, you'll touch B.dbo.x.
So when you run the DDL for creating databases A and B against Babelfish, you'll get basically the same as what you had in SQL Server and there is no need to change any syntax (again, assuming cross-DB queries are not currently needed).
Now, if your question is how to merge databases A and B into a single database, then that is not different from how you would do that in SQL Server itself. In this case I would recommend actually performing that merge in SQL Server, then reverse-engineering the resulting SQL Server database, and running that script against Babelfish to recreate that database.