我有一个带有架构A的Oracle数据库,它具有DBA_ *视图的选择权限。
我还有一个没有这些权限的模式B,但它有很多物化视图。
在架构A中,有三个刷新组,每个刷新组都具有来自架构B的一些物化视图。
我想检查刷新组中是否有快照,但是我想将此检查连接为B。
我正在使用以下查询在架构A中执行此检查:
SELECT OWNER, NAME FROM DBA_SNAPSHOTS WHERE OWNER = 'B'
MINUS
SELECT OWNER, NAME FROM DBA_REFRESH_CHILDREN WHERE RNAME IN ('REFRESH_G1','REFRESH_G2','REFRESH_G3');
问题:
所以:
谢谢!
答案 0 :(得分:0)
在A
CREATE OR REPLACE VIEW V_REFRESH_SNAPSHOT AS
SELECT OWNER, NAME FROM DBA_SNAPSHOTS WHERE OWNER = 'B'
MINUS
SELECT OWNER, NAME FROM DBA_REFRESH_CHILDREN WHERE RNAME IN ('REFRESH_G1','REFRESH_G2','REFRESH_G3');
GRANT SELECT ON A.V_REFRESH_SNAPSHOT TO B;
来自B
SELECT * FROM A.V_REFRESH_SNAPSHOT;