ITPub博客

首页 > Linux操作系统 > Linux操作系统 > MV--如何去purge mlog$_表中的rows

MV--如何去purge mlog$_表中的rows

原创 Linux操作系统 作者:vongates 时间:2019-06-28 19:15:04 0 删除 编辑

因為在子公司之間同步一些表的數據,現行采用MV來做,可是用來存放MV LOG的表的記錄不斷的增長。占用很大的表空間。所以就想到了要purge掉這些沒有用的log,查看了ORACLE的Documents : http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96568/rarmviea.htm#94092 有相關的說明:

我用DBMS_MVIEW.PURGE_LOG 這個package來實現:下面是它的一些說明和實例

Only the owner of a materialized view log or a user with the EXECUTE privilege for the DBMS_MVIEW package can purge rows from the materialized view log by executing the PURGE_LOG procedure.


Purging Rows from a Materialized View Log

Always try to keep a materialized view log as small as possible to minimize the database space that it uses. To remove rows from a materialized view log and make space for newer log records, you can perform one of the following actions:

  • Refresh the materialized views associated with the log so that Oracle can purge rows from the materialized view log.
  • Manually purge records in the log by deleting rows required only by the nth least recently refreshed materialized views.

To manually purge rows from a materialized view log, execute the PURGE_LOG procedure of the DBMS_MVIEW package at the database that contains the log. For example, to purge entries from the materialized view log of the customers table that are necessary only for the least recently refreshed materialized view, execute the following procedure:

BEGIN
   DBMS_MVIEW.PURGE_LOG (
      master => 'hr.employees',
      num    => 1,
      flag   => 'DELETE');
END;
/

Only the owner of a materialized view log or a user with the EXECUTE privilege for the DBMS_MVIEW package can purge rows from the materialized view log by executing the PURGE_LOG procedure.

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

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2018-09-11

  • 博文量
    448
  • 访问量
    289674