ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Tips--查看当前正在刷新的MView

Tips--查看当前正在刷新的MView

原创 Linux操作系统 作者:vongates 时间:2019-06-25 16:54:04 0 删除 编辑

在我们的工作中,有很多时候是通过MView(snapshot)来复制表到另外一个DB,如果我们想知道当前正常刷新哪些MV的话。可以通下面的这个SQL来实现。


select username, sid, rowner, rname
from (select username, s.sid, rc.rowner, rc.rname, count(*)
from v$lock l, dba_objects o, v$session s, dba_refresh_children rc
where o.object_id = l.id1
and l.type = 'JI'
and l.lmode = 6
and s.sid = l.sid
and o.object_type = 'TABLE'
and o.object_name = rc.name
and o.owner = rc.owner
and rc.type = 'SNAPSHOT'
group by username, s.sid, rc.rowner, rc.rname
having count(*) = (select count(*)
from dba_refresh_children
where rowner = rc.rowner
and rname = rc.rname
and type = 'SNAPSHOT'));

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51922/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-09-11

  • 博文量
    449
  • 访问量
    320914