oracle logminer

第一步:首先在spfile中添加一下内容:

SQL> alter system set UTL_FILE_DIR = 'd:/search' scope = spfile;(目录可以是任意位置)

SQL> shutdown immediate;

SQL> startup;



第二步:创建字典文件:

EXECUTE   dbms_logmnr_d.build(dictionary_filename=>'sqltrace.ora',dictionary_location=>'d:/search');

第三步:将待查询内容的日志文件添加到字典中去

exec dbms_logmnr.add_logfile(options =>dbms_logmnr.new, logfilename =>'E:\oracle_data\oradata\testdb\redo01.log');

如果还要添加日志文件,则将DBMS_LOGMNR.NEW改为DBMS_LOGMNR.ADDFILE;

exec dbms_logmnr.add_logfile(options => dbms_logmnr.addfile, logfilename =>'E:\oracle_data\oradata\testdb\redo02.log');

exec dbms_logmnr.add_logfile(options => dbms_logmnr.addfile, logfilename =>'E:\oracle_data\oradata\testdb\redo03.log');


第四步:分析数据

exec dbms_logmnr.start_logmnr(DictFileName=>'d:/search/sqltrace.ora');

第五部:查看内容

select username, sql_redo, sql_undo from v$logmnr_contents where username ='sys' and peration ='select';

你可能感兴趣的:(oracle,sql)