##########################
#
# DBMS_LOGMNR
#
STORE SET /tmp/_sqlplus-env.sql
SET AUTOP OFF
set long 200000
set lines 180
set trimspool on
set heading off
set feedback off
set pages 0
set verify off
set echo off
set timing offn
SET LINESIZE 5000
SET TERMOUT OFF
SET TRIMS ON
WHENEVER SQLERROR EXIT SQL.SQLCODE;
WHENEVER OSERROR EXIT FAILURE;
set serveroutput on;
spool /tmp/_tmp2run.sql
select case rownum
when 1 then
'EXECUTE sys.DBMS_LOGMNR.ADD_LOGFILE( LOGFILENAME => '|| '''' || name || '''' ||', OPTIONS => sys.DBMS_LOGMNR.NEW);'||chr(10)
else
'EXECUTE sys.DBMS_LOGMNR.ADD_LOGFILE( LOGFILENAME => '|| '''' || name || '''' ||', OPTIONS => sys.DBMS_LOGMNR.ADDFILE);'||chr(10)
end
from ( select name from V$ARCHIVED_LOG where DEST_ID=1 and name is not null order by FIRST_TIME desc) a where rownum < 21; spool off host grep '^EXECUTE' /tmp/_tmp2run.sql > /tmp/_sql2run.sql
@/tmp/_sqlplus-env.sql
@/tmp/_sql2run.sql
host rm /tmp/_sqlplus-env.sql
host rm /tmp/_tmp2run.sql
host rm /tmp/_sql2run.sql
SET LINESIZE 300
EXECUTE sys.DBMS_LOGMNR.START_LOGMNR(OPTIONS => sys.DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG + sys.DBMS_LOGMNR.COMMITTED_DATA_ONLY);
SELECT count(*), OPERATION, TABLE_NAME, SEG_TYPE_NAME, TABLE_SPACE FROM V$LOGMNR_CONTENTS group by OPERATION, TABLE_NAME, SEG_TYPE_NAME, TABLE_SPACE order by 1;
-- or
col SESSION_INFO for a40
SELECT count(*), OPERATION, TABLE_NAME, TABLE_SPACE, SEG_TYPE_NAME, USERNAME, SESSION_INFO FROM V$LOGMNR_CONTENTS group by OPERATION, TABLE_NAME, SEG_TYPE_NAME, TABLE_SPACE, username, SESSION_INFO order by 1;
-- or
col SESSION_INFO for a100
select SESSION_INFO, min( TIMESTAMP ), max( TIMESTAMP ) from V$LOGMNR_CONTENTS group by SESSION_INFO;
-- or
col filename for a50
select FILENAME, LOW_TIME, HIGH_TIME from V$LOGMNR_LOGS;
-- or
col SQL_REDO for a100
col SESSION_INFO for a60
define _TABLE_NAME='NMS_ATTRIBUTE'
define _OPERATION='INSERT'
define _TABLESPACE='KAZNA_PSS_NOLOG'
SELECT USERNAME, SESSION_INFO, SQL_REDO FROM V$LOGMNR_CONTENTS where TABLE_NAME='&_TABLE_NAME' and OPERATION = '&_OPERATION' and TABLE_SPACE = '&_TABLESPACE';
EXECUTE sys.DBMS_LOGMNR.END_LOGMNR;
#
# DBMS_LOGMNR
#
###########################
SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
если YES or IMPLICIT то всё хорошо, можно получить инфу по chained rows и cluster tables. Но если нет, то вывода будет вполне достаточно что-бы понять что происходит, кто генерит redo.
если мало то ALTER DATABASE ADD SUPPLEMENTAL LOG DATA statement.
reedo генерится если на таблице есть:
- trigger
- constraint
- option logging set to true
- if data storage object located in tablespace with logging option
redo не генерится если:
- SQL*Loader direct load operations
- Database nologging & Tablespace nologging & Object nologging
- - direct-load INSERT : insert /*+ APPEND */
- - direct-load INSERT : insert in without hint in parallel mode because direct path insert is the default
- CREATE TABLE ... AS SELECT
- CREATE INDEX
- ALTER TABLE ... MOVE PARTITION
- ALTER TABLE ... SPLIT PARTITION
- ALTER INDEX ... SPLIT PARTITION
- ALTER INDEX ... REBUILD
- ALTER INDEX ... REBUILD PARTITION
- INSERT /*+APPEND*/ INTO AS SELECT ...
- INSERT, UPDATE, and DELETE on LOBs in NOCACHE NOLOGGING mode stored out of line
No comments:
Post a Comment