-->

DB2 linking schemas across multiple instances

2019-09-13 19:26发布

问题:

I have a few instances of DB2 10.5 server running on one physical Linux machine, let name them INST1 and INST2.

All of them contain multiple schemas, however schema-naming is unique accross whole machine, for example INST1_SCHEMA_A, INST2_SCHEMA_A etc.

What I would like to do is to somehow create a user that can access all of those schemas as they were on one instance, so it would be possible to make a queries like: SELECT ID FROM INST1_SCHEMA_A UNION SELECT ID FROM INST2_SCHEMA_A

How can I achieve that? Should I just link databases and alias schemas?

回答1:

Federation

is the keyword for your request. DB2 LUW to DB2 LUW is included in the license and this could be done across multiple databases - not matter if they reside within the same instance, another instance on the same server or even a different server.

Set FEDERATED = YES in the DBM CFG, define a server and set up Nicknames for remote tables. For details refer to this article or this one or the IBM Knowledge Center.