show parameter UTL_FILE_DIR
If it is unassigned,
SQL> alter system set utl_file_dir='d:\lgmnr\dict' scope=spfile ; --make sure
d:\lgmnr\dict folder exists in db server before running this command
You have to restart the Database after running the above command.
EXECUTE
DBMS_LOGMNR_D.BUILD('dictionary.ora','D:\lgmnr\dict\',DBMS_LOGMNR_D.STORE_IN_FLA
T_FILE);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('archivefile name with full path'); --Add at least 5 of the logfiles
EXECUTE DBMS_LOGMNR.START_LOGMNR(DICTFILENAME =>'d:\lgmnr\dict\dictionary.ora');
select TABLE_NAME,count(*) from V$LOGMNR_CONTENTS group by table_name; --spool
this info into a file
EXECUTE DBMS_LOGMNR.END_LOGMNR;
exec dbms_logmnr_d.build(dictionary_filename=>'dictionary.ora', dictionary_location=>'D:\lgmnr\dict',options=>dbms_logmnr_d.store_in_flat_file);
SET PAUSE ON
SET PAUSE 'Press Return/enter to Continue'
SET PAGESIZE 60
SET LINESIZE 300
SET VERIFY OFF
COL "Generation Date" FORMAT a20
SELECT TRUNC(completion_time) "Generation Date" ,
round(SUM(blocks*block_size)/1048576,0) "Total for the Day in MB"
FROM gv$archived_log
GROUP BY TRUNC(completion_time)
ORDER BY TRUNC(completion_time)
/
If it is unassigned,
SQL> alter system set utl_file_dir='d:\lgmnr\dict' scope=spfile ; --make sure
d:\lgmnr\dict folder exists in db server before running this command
You have to restart the Database after running the above command.
EXECUTE
DBMS_LOGMNR_D.BUILD('dictionary.ora','D:\lgmnr\dict\',DBMS_LOGMNR_D.STORE_IN_FLA
T_FILE);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('archivefile name with full path'); --Add at least 5 of the logfiles
EXECUTE DBMS_LOGMNR.START_LOGMNR(DICTFILENAME =>'d:\lgmnr\dict\dictionary.ora');
select TABLE_NAME,count(*) from V$LOGMNR_CONTENTS group by table_name; --spool
this info into a file
EXECUTE DBMS_LOGMNR.END_LOGMNR;
exec dbms_logmnr_d.build(dictionary_filename=>'dictionary.ora', dictionary_location=>'D:\lgmnr\dict',options=>dbms_logmnr_d.store_in_flat_file);
SET PAUSE ON
SET PAUSE 'Press Return/enter to Continue'
SET PAGESIZE 60
SET LINESIZE 300
SET VERIFY OFF
COL "Generation Date" FORMAT a20
SELECT TRUNC(completion_time) "Generation Date" ,
round(SUM(blocks*block_size)/1048576,0) "Total for the Day in MB"
FROM gv$archived_log
GROUP BY TRUNC(completion_time)
ORDER BY TRUNC(completion_time)
/
EXAMPLE:
show parameter UTL_FILE_DIR
alter system set utl_file_dir='d:\lgmnr\dict' scope=spfile ;
EXECUTE
DBMS_LOGMNR_D.BUILD('dict.ora','d:\lgmnr\dict',DBMS_LOGMNR_D.STORE_IN_FLAT_FILE);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('G:\ORADATA\Archivelog\ARC0000031884_0929216354.0001');
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('G:\ORADATA\Archivelog\ARC0000031885_0929216354.0001');
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('G:\ORADATA\Archivelog\ARC0000031886_0929216354.0001');
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('G:\ORADATA\Archivelog\ARC0000031887_0929216354.0001');
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('G:\ORADATA\Archivelog\ARC0000031888_0929216354.0001');
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('G:\ORADATA\Archivelog\ARC0000031889_0929216354.0001');
EXECUTE DBMS_LOGMNR.START_LOGMNR(DICTFILENAME =>'d:\lgmnr\dict\dict.ora');
SQL> select TABLE_NAME,count(*) from v$logmnr_contents group by table_name;
TABLE_NAME COUNT(*)
-------------------------------- ----------
2133
SCHEDULER$_EVENT_LOG 3
MON_MODS_ALL$ 17
OPT_FINDING_OBJ$ 1
MV_DL_EVENTSLOG 74405
MV_REFRESH_USAGE_STATS$ 2
SNAP$ 1
SCHEDULER$_JOB_RUN_DETAILS 3
SCHEDULER$_JOB 14
OBJ$ 89
DBMS_LOCK_ALLOCATED 6
TABLE_NAME COUNT(*)
-------------------------------- ----------
MON_MODS$ 34
SNAP_REFTIME$ 1
SUM$ 4
SMON_SCN_TIME 8
USER$ 14
OPT_FINDING$ 1
OPT_DIRECTIVE$ 1
OPTSTAT_HIST_CONTROL$ 2
JOB$ 2
COL_USAGE$ 106
SEG$ 394
TABLE_NAME COUNT(*)
-------------------------------- ----------
IND$ 37
OPT_DIRECTIVE_OWN$ 1
24 rows selected.
SQL> spool off
After getting the result, end the log miner. After ending you will not get the
results.
To end logminer,
EXECUTE DBMS_LOGMNR.END_LOGMNR;
DM_DL_EVENTSLOG is generating more redo (check in above output)
To alter the materialzed view to no logging
ALTER MATERIALIZED VIEW <schema.materialized_view> <LOGGING | NOLOGGING>;
FORCE LOGGING clause can be ignored If you have done as recommended here.
ALTER MATERIALIZED VIEW CH.DM_DL_EVENTSLOG NOLOGGING;
ALTER MATERIALIZED VIEW TEST.DM_DL_EVENTSLOG NOLOGGING;
No comments:
Post a Comment