因為在子公司之間同步一些表的數據,現行采用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/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29987/viewspace-51618/