使用LogMiner 的简单步骤

类别:数据库 点击:0 评论:0 推荐:

1.创建DBMS_LOGMNR包
SQL>@$ORACLE_HOME/rdbms/admin/dbmslm.sql

2.创建相关数据字典
SQL>@$ORACLE_HOME/rdbms/admin/dbmslmd.sql

3.修改初始化参数UTL_FILE_DIR,指定分析数据的存放处
SQL>alter system set UTL_FILE_DIR='/opt/oracle/logminer' scope=spfile;

4.重启数据库
SQL>shutdown immediate
SQL>startup

5.创建数据字典文件

SQL>execute dbms_logmnr_d.build(dictionary_filename =>'sqltrace.ora',dictionary

_location =>'/opt/oracle/logminer/log');

6.建立日志分析表

SQL> execute dbms_logmnr.add_logfile(options =>dbms_logmnr.new,logfilename =>'/opt/oracle/ora92/rdbms/ARC00009.001');


7.添加用于分析的日志文件

SQL> execute dbms_logmnr.add_logfile(options =>dbms_logmnr.addfile,logfilename=>'/opt/oracle/ora92/rdbms/ARC00010.001');

SQL> execute dbms_logmnr.add_logfile(options =>dbms_logmnr.addfile,logfilename =>/opt/oracle/ora92/rdbms/ARC00011.001');

删除

SQL> execute dbms_logmnr.add_logfile(options =>dbms_logmnr.removefile,logfilenam

e =>'/opt/oracle/ora92/rdbms/ARC00011.001');


 8.启动LogMiner进行分析

SQL> execute dbms_logmnr.start_logmnr(dictfilename =>'/opt/oracle/logminer/log/sqltrace.or

a',starttime =>to_date('20040625 09:00:00','yyyymmdd hh24:mi:ss'),endtime =>to_date('20040625 22:00:00','yyyymmdd hh24:mi:ss'));

9.参看分析结果

select operation,sql_redo,sql_undo from v$logmnr_contents;

 
10.结束分析

SQL> execute dbms_logmnr.end_logmnr;

一旦结束视图v$logmnr_contents中的分析结果也随之不再存在。

本文地址:http://com.8s8s.com/it/it19594.htm