Is there a way to find out activities due to redo logs [message #665548] |
Sun, 10 September 2017 05:21 |
|
juniordbanewbie
Messages: 250 Registered: April 2014
|
Senior Member |
|
|
Dear all,
here' the hours where the redo log switches are the lowest.
SYS@berlin>SELECT * FROM(
2 SELECT row_number() OVER (ORDER BY redo_count) rn, partial_first_time, redo_count FROM(
3 SELECT to_char(first_time,'YYYY-MM-DD HH24') partial_first_time, count(0) redo_count
4 FROM v$log_history GROUP BY to_char(first_time,'YYYY-MM-DD HH24') ORDER BY count(0)
5 )
6 ) WHERE rn>=1 and rn<=5;
RN PARTIAL_FIRST REDO_COUNT
--- ------------- ----------
1 2017-09-10 11 1
2 2017-08-20 11 2
3 2017-08-20 16 2
4 2017-08-21 01 2
5 2017-08-23 03 2
here' the hours where the redo log switches are the highest.
SYS@berlin>
SYS@berlin>--top 5 lowest redo log period
SYS@berlin>SELECT * FROM(
2 SELECT row_number() OVER (ORDER BY redo_count DESC) rn, partial_first_time, redo_count FROM(
3 SELECT to_char(first_time,'YYYY-MM-DD HH24') partial_first_time, count(0) redo_count
4 FROM v$log_history GROUP BY to_char(first_time,'YYYY-MM-DD HH24') ORDER BY count(0)
5 )
6 ) WHERE rn>=1 and rn<=5;
RN PARTIAL_FIRST REDO_COUNT
--- ------------- ----------
1 2017-08-23 11 67
2 2017-09-07 22 61
3 2017-08-18 22 61
4 2017-09-07 21 61
5 2017-09-07 01 60
it flunctues a lot.
Is there a way to find out which are the sql or activies that cause a high number of redo log switches?
thanks
|
|
|
Re: Is there a way to find out activities due to redo logs [message #665552 is a reply to message #665548] |
Sun, 10 September 2017 07:39 |
|
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
juniordbanewbie wrote on Sun, 10 September 2017 03:21Dear all,
here' the hours where the redo log switches are the lowest.
SYS@berlin>SELECT * FROM(
2 SELECT row_number() OVER (ORDER BY redo_count) rn, partial_first_time, redo_count FROM(
3 SELECT to_char(first_time,'YYYY-MM-DD HH24') partial_first_time, count(0) redo_count
4 FROM v$log_history GROUP BY to_char(first_time,'YYYY-MM-DD HH24') ORDER BY count(0)
5 )
6 ) WHERE rn>=1 and rn<=5;
RN PARTIAL_FIRST REDO_COUNT
--- ------------- ----------
1 2017-09-10 11 1
2 2017-08-20 11 2
3 2017-08-20 16 2
4 2017-08-21 01 2
5 2017-08-23 03 2
here' the hours where the redo log switches are the highest.
SYS@berlin>
SYS@berlin>--top 5 lowest redo log period
SYS@berlin>SELECT * FROM(
2 SELECT row_number() OVER (ORDER BY redo_count DESC) rn, partial_first_time, redo_count FROM(
3 SELECT to_char(first_time,'YYYY-MM-DD HH24') partial_first_time, count(0) redo_count
4 FROM v$log_history GROUP BY to_char(first_time,'YYYY-MM-DD HH24') ORDER BY count(0)
5 )
6 ) WHERE rn>=1 and rn<=5;
RN PARTIAL_FIRST REDO_COUNT
--- ------------- ----------
1 2017-08-23 11 67
2 2017-09-07 22 61
3 2017-08-18 22 61
4 2017-09-07 21 61
5 2017-09-07 01 60
it flunctues a lot.
Is there a way to find out which are the sql or activies that cause a high number of redo log switches?
thanks
DBMS_LOGMNR can reveal details about the DML that results in the REDO activity.
also statspack/AWR report should reveal activity during these periods.
|
|
|
|
|
|
|
Re: Is there a way to find out activities due to redo logs [message #668130 is a reply to message #668125] |
Thu, 08 February 2018 06:20 |
|
juniordbanewbie
Messages: 250 Registered: April 2014
|
Senior Member |
|
|
Dear Michel,
below supplemental logging not enable
SYS@ol73-12102-se-si orcl>select table_space, username, seg_name,count(0) archivelog_count from v$logmnr_contents where seg_name is not null
2 AND SEG_NAME NOT LIKE '%$'
3 AND SEG_OWNER NOT IN ('SYS', 'SYSTEM')
4 GROUP BY table_space, username, seg_name ORDER BY count(0) DESC;
TABLE_SPACE USERNAME SEG_NAME ARCHIVELOG_COUNT
-------------------- -------------------- ---------------------------------------- ----------------
TEST UNKNOWN FORALL_TEST 10
SYSAUX UNKNOWN CLI_SWP$b77ce52e$1$1 2
UNKNOWN FORALL_TEST 1
below with supplemental logging with supplemental logging you can know the user who executes the statement
SYS@ol73-12102-se-si orcl>select table_space, username, seg_name,count(0) archivelog_count from v$logmnr_contents where seg_name is not null
2 AND SEG_NAME NOT LIKE '%$'
3 AND SEG_OWNER NOT IN ('SYS', 'SYSTEM')
4 GROUP BY table_space, username, seg_name ORDER BY count(0) DESC;
TABLE_SPACE USERNAME SEG_NAME ARCHIVELOG_COUNT
-------------------- -------------------- ---------------------------------------- ----------------
SYSAUX UNKNOWN CLI_SWP$b77ce52e$1$1 4
TEST TEST FORALL_TEST 1
Yes I did try it. It did solve my problem but not directly because the statement I mined are those normal application sqls which the application team has confirmed. I did not tuned any sql. I simply add create large redo log group and more redo log group.
|
|
|
Re: Is there a way to find out activities due to redo logs [message #668135 is a reply to message #668130] |
Thu, 08 February 2018 08:47 |
|
Michel Cadot
Messages: 68722 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
You can also use it without supplemental logging but as you didn't show what you did to activate Log Miner we cannot say what you did wrong.
I prove it (example taken from the links I provided):
SQL> select SUPPLEMENTAL_LOG_DATA_FK, SUPPLEMENTAL_LOG_DATA_ALL from v$database;
SUP SUP
--- ---
NO NO
SQL> drop table t1 purge;
Table dropped.
SQL> create table t1 as select level val from dual connect by level <= 10;
Table created.
SQL> select * from t1;
VAL
----------
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> begin
2 sys.dbms_logmnr.add_logfile (logfilename=>'E:\ORACLE\BASES\MIKB2\RL_G1_1.RDO',
3 options=>sys.dbms_logmnr.NEW);
4 sys.dbms_logmnr.add_logfile (logfilename=>'E:\ORACLE\BASES\MIKB2\RL_G2_1.RDO',
5 options=>sys.dbms_logmnr.ADDFILE);
6 sys.dbms_logmnr.add_logfile (logfilename=>'E:\ORACLE\BASES\MIKB2\RL_G3_1.RDO',
7 options=>sys.dbms_logmnr.ADDFILE);
8 sys.dbms_logmnr.add_logfile (logfilename=>'E:\ORACLE\BASES\MIKB2\RL_G4_1.RDO',
9 options=>sys.dbms_logmnr.ADDFILE);
10 sys.dbms_logmnr.start_logmnr (
11 startTime => trunc(sysdate),
12 endTime => sysdate,
13 options => sys.dbms_logmnr.skip_corruption
14 + sys.dbms_logmnr.committed_data_only
15 + sys.dbms_logmnr.dict_from_online_catalog
16 );
17 end;
18 /
PL/SQL procedure successfully completed.
SQL> select operation, table_space, username from v$logmnr_contents where seg_name='T1' and seg_owner='MICHEL';
OPERATION TABLE_SPACE USERNAME
-------------------------------- -------------------------------- ------------------------------
DDL MICHEL
DDL MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
DIRECT INSERT TS_D01 MICHEL
12 rows selected.
SQL> exec sys.dbms_logmnr.end_logmnr;
PL/SQL procedure successfully completed.
|
|
|
|
|
|
|
Re: Is there a way to find out activities due to redo logs [message #668933 is a reply to message #668146] |
Sat, 24 March 2018 05:10 |
|
juniordbanewbie
Messages: 250 Registered: April 2014
|
Senior Member |
|
|
Dear Michel,
I did what you told me.
SYSTEM@berlin>select SUPPLEMENTAL_LOG_DATA_FK, SUPPLEMENTAL_LOG_DATA_ALL from v$database;
SUP SUP
--- ---
NO NO
TEST@berlin>create table t1 as select level val from dual connect by level <= 10;
Table created.
TEST@berlin>select * from t1;
VAL
----------
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SYSTEM@berlin> alter system switch logfile;
System altered.
1 begin
2 sys.dbms_logmnr.add_logfile (logfilename=>'/u02/app/oracle/oradata/o121space/redo02.log',
3 options=>sys.dbms_logmnr.NEW);
4 sys.dbms_logmnr.add_logfile (logfilename=>'/u02/app/oracle/oradata/o121space/redo03.log',
5 options=>sys.dbms_logmnr.ADDFILE);
6 sys.dbms_logmnr.add_logfile (logfilename=>'/u02/app/oracle/oradata/o121space/redo01.log',
7 options=>sys.dbms_logmnr.ADDFILE);
8 sys.dbms_logmnr.start_logmnr (
9 startTime => trunc(sysdate),
10 endTime => sysdate,
11 options => sys.dbms_logmnr.skip_corruption
12 + sys.dbms_logmnr.committed_data_only
13 + sys.dbms_logmnr.dict_from_online_catalog
14 );
15* end;
16
17 /
PL/SQL procedure successfully completed.
select operation, table_space, username from v$logmnr_contents where seg_name='T1' and seg_owner='TEST';
SYSTEM@berlin>select operation, table_space, username from v$logmnr_contents where seg_name='T1' and seg_owner='TEST';
OPERATION TABLE_SPACE
-------------------------------- --------------------------------
USERNAME
------------------------------
DDL
TEST
DIRECT INSERT TEST
TEST
DIRECT INSERT TEST
TEST
OPERATION TABLE_SPACE
-------------------------------- --------------------------------
USERNAME
------------------------------
DIRECT INSERT TEST
TEST
DIRECT INSERT TEST
TEST
DIRECT INSERT TEST
TEST
OPERATION TABLE_SPACE
-------------------------------- --------------------------------
USERNAME
------------------------------
DIRECT INSERT TEST
TEST
DIRECT INSERT TEST
TEST
DIRECT INSERT TEST
TEST
OPERATION TABLE_SPACE
-------------------------------- --------------------------------
USERNAME
------------------------------
DIRECT INSERT TEST
TEST
DIRECT INSERT TEST
TEST
11 rows selected.
SYSTEM@berlin>exec sys.dbms_logmnr.end_logmnr;
PL/SQL procedure successfully completed.
exactly the same.
thanks
|
|
|
|
|
|