Get the App
SLTechnology News&Howtos  ›  Database  › 

How to reasonably use logmnr for log mining and minimize the impact on production database

Shulou Source: shulou.com Published: 2022-06-01 15:45:14 11月12日 Update

Oracle Logmnr this tool how to use here is not detailed, you can check the official documents, the Internet is also a lot of documents, find their own. I'll go straight to practical information here.

-- create Oracle directory

Select * from dba_directories

Create directory archivelog_dir as'/ archivelog1/temp_archivelog/'

-- grant read, write on directory archivelog_dir to zhanghui

-- Archive log path information table (tmp_archive_log), mainly to save the path of the log to be mined

Note: to add status flag bits to the table, 0 is unmined and 1 is mined

Create table tmp_archive_log as

Select name, 0 flag from v$archived_log

Where first_time > = to_date ('2012-12-25 1315 1515 5500 mm hh34:mi:ss' hh34:mi:ss')

And first_timedbms_logmnr.dict_from_online_catalog); end; insert into / * + append * / zhanghui.logmnr_contents select timestamp,log_id,seg_owner,seg_name,table_name,username,operation,sql_redo,sql_undo from v$logmnr_contents-- where table_name='' and OPERATION='DELETE'; begin sys.dbms_logmnr.end_logmnr; end; UPDATE zhanghui.tmp_archive_log set flag = 1 where name= vested sql dirarclog; commit; end loop -- after running, call the SMS API close vCur;EXCEPTION WHEN OTHERS THEN ROLLBACK;-- if you report the wrong SMS message, call the SMS API-- dbms_output.put_line (sqlerrm); END proc_logmnr_batch

-- using the operating system to call stored procedure scripts

$cat proc_logmnr_batch.sh

#! / bin/bashsqlplus / as sysdba

Tags: Log SMS analysis processing impact content clockwork manual interface data document path production operating system business two information memory single background Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB MySQL Huawei Shulou Information Apple