防止Oracle LogMiner在闪回恢复区创建归档日志
我正在尝试使用 Oracle LogMiner(DBMS_LOGMNR
包)来实现基于重做日志的审计跟踪功能。但是每次当我查询V$LOGMNR_CONTENTS
时,它都会在闪回恢复区(SELECT NAME FROM V$RECOVERY_FILE_DEST
)中创建几个大的(最多50M)归档日志文件,尽管事实上,我的测试数据库中每小时只有几个事务。使用 Oracle LogMiner 几次后,闪回恢复区中的所有空间都被用完,Oracle 停止工作。
有没有办法阻止Oracle LogMiner在闪回恢复区创建归档日志?
我按以下方式初始化 Oracle LogMiner:
SYS.DBMS_LOGMNR_D.BUILD(options => SYS.DBMS_LOGMNR_D.STORE_IN_REDO_LOGS);
SYS.DBMS_LOGMNR.START_LOGMNR(startScn => PREV_SCN, endScn => NEXT_SCN,
options =>
SYS.DBMS_LOGMNR.COMMITTED_DATA_ONLY +
SYS.DBMS_LOGMNR.DICT_FROM_REDO_LOGS +
SYS.DBMS_LOGMNR.SKIP_CORRUPTION +
SYS.DBMS_LOGMNR.CONTINUOUS_MINE
);
在我的情况下,PREV_SCN 和 NEXT_SCN 之间的距离始终很小,并且仅涵盖几个事务。
当我使用 ALTER DATABASE NOARCHIVELOG; 关闭存档日志时,DBMS_LOGMNR_D.BUILD
引发 ORA-01325
:必须启用存档日志模式才能构建进入日志流。
I'm trying to use Oracle LogMiner (DBMS_LOGMNR
package) for implementation of audit trails functionality based on redo logs. But each time when I query V$LOGMNR_CONTENTS
it creates several big (up to 50M) archived logs files in flash recovery area (SELECT NAME FROM V$RECOVERY_FILE_DEST
) in spite the fact that there were only several transactions per hour in my test DB. After several times of using Oracle LogMiner all space in flash recovery area becomes used and Oracle stops working.
Is there any way to prevent Oracle LogMiner from creating archived logs in flash recovery area?
I initialize Oracle LogMiner in the following way:
SYS.DBMS_LOGMNR_D.BUILD(options => SYS.DBMS_LOGMNR_D.STORE_IN_REDO_LOGS);
SYS.DBMS_LOGMNR.START_LOGMNR(startScn => PREV_SCN, endScn => NEXT_SCN,
options =>
SYS.DBMS_LOGMNR.COMMITTED_DATA_ONLY +
SYS.DBMS_LOGMNR.DICT_FROM_REDO_LOGS +
SYS.DBMS_LOGMNR.SKIP_CORRUPTION +
SYS.DBMS_LOGMNR.CONTINUOUS_MINE
);
Distance between PREV_SCN and NEXT_SCN is always small in my case and covers only several transactions.
When I use ALTER DATABASE NOARCHIVELOG;
to turn off archived logs, DBMS_LOGMNR_D.BUILD
raises ORA-01325
: archive log mode must be enabled to build into the logstream.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Logminer 在重做日志中创建条目的原因是因为您特别要求了它:
如果您不希望 logminer 将其数据存储在重做日志中,请改用 DBMS_LOGMNR_D.STORE_IN_FLAT_FILE 。有关如何设置的分步指南,请参阅此博客说明使用平面文件的 logminer。
the reason why Logminer creates entries in the redo log is because you have asked it specifically:
If you don't want logminer to store its data in the redo logs, use
DBMS_LOGMNR_D.STORE_IN_FLAT_FILE
instead. See this blog note for example for a step by step guide on how to setup logminer using flat files.