How can you create an Oracle view that reads开发者_开发技巧 data from two schemas in two different instances?
We know how to do this with two schemas in the same instance:
CREATE VIEW MYVIEW AS
SELECT X,Y,Z FROM A.MYTABLE
UNION
SELECT X,Y,Z FROM B.MYTABLE
But what if schemas A
and B
are in different Oracle instances?
You could create a database link: http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/ds_concepts002.htm#ADMIN12092 and then do
CREATE VIEW MYVIEW AS
SELECT X,Y,Z FROM A.MYTABLE
UNION
SELECT X,Y,Z FROM B.MYTABLE@<LinkName>
精彩评论