如何在 System z 上的 DB2 中创建模式别名?
我们用于开发的报告工具包的一部分被配置为始终使用相同的架构(例如XYZZY
)。
但是,某些客户已将其数据存储在不同的架构 PLUGH
中。 DB2/z 中是否有任何方法可以为整个模式 XYZZY
指定别名以引用模式PLUGH
中的对象?
该报告工具包使用 DB2 Connect Enterprise Edition 或 Personal Edition 9.1 驱动程序在 ODBC 之上运行。
我知道我可以为表和视图设置单独的别名,但我们有数百个这样的数据库对象,做这一切将是一件非常痛苦的事情。让 DB2 自动神奇地转换整个模式会容易得多。
请记住,我们并不是在寻求能够运行多个模式,我们只是想要一种将对数据库对象的所有请求重定向到单个不同名称的模式的方法。
当然,如果有一种方法可以在每个连接的基础上获取多个模式,那也很好。但我没有帮助。
Part of a reporting toolkit we use for our development is configured to always use the same schema (say XYZZY
).
However, certain customers have stored their data in a different schema PLUGH
. Is there any way within DB2/z to alias the entire schema XYZZY
to refer to the objects in schema PLUGH
?
The reporting toolkit runs on top of ODBC using the DB2 Connect Enterprise Edition or Personal Edition 9.1 drivers.
I know I can set up individual aliases for tables and views but we have many hundreds of these database objects and it will be a serious pain to do the lot. It would be far easier to simply have DB2 auto-magically translate the whole schema.
Keep in mind we're not looking for being able to run with multiple schemas, we just want a way to redirect all requests for database objects to a single, differently named, schema.
Of course, if there's a way to get multiple schemas on a per-connection basis, that would be good as well. But I'm not helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜测 DB/2 schema 是指某些两部分对象名称中的限定名称。为了
例如,如果两个
零件表名称为:
PLUGH.SOME_TABLE_NAME
。您想要将 XYZZY 定义为PLUGH
的别名,以便报告程序可以将表引用为XYZZY.SOME_TABLE_NAME
。我不知道如何直接执行此操作(据我所知,架构名称不采用别名)。
您对定义个人别名的反对意见
使用类似这样的东西:
是有数百个任务要做,这使它成为一个真正的痛苦。你有没有想过
对 DB/2 目录使用
SELECT
来生成CREATE ALIAS
语句您需要引用的每个对象?类似于:
将输出捕获到文件中然后执行它。可能有数百个命令,
但至少你不必写它们。
I am guessing that by DB/2 schema you mean the qualifying name in some two part object name. For
example, if a two
part table name is:
PLUGH.SOME_TABLE_NAME
. You want to do defineXYZZY
as analias name for
PLUGH
so the reporting program can refer to the table asXYZZY.SOME_TABLE_NAME
.I don't know how to directly do that (schema names don't take on aliases as far as I am aware).
The objection you have to defining individual alias names
using something like:
is that there are hundreds of them to do making it a real pain. Have you thought about
using a
SELECT
against the DB/2 catalogue to generateCREATE ALIAS
statements foreach of the objects you need to refer to? Something like:
Capture the output into a file then execute it. Might be hundreds of commands,
but at least you didn't have to write them.