Although it's written to provide information per instance in RACs, it will also work in Single Instances.
SELECT C.INSTANCE,
C.THREAD#,
B.SEQUENCE# "START SEQUENCE",
TO_CHAR (B.FIRST_TIME, 'DD-MM-YYYY HH24:MI:SS') "START TIME",
A.SEQUENCE# "END SEQUENCE",
TO_CHAR (A.FIRST_TIME, 'DD-MM-YYYY HH24:MI:SS') "END TIME",
TO_CHAR (
TRUNC (SYSDATE)
+ NUMTODSINTERVAL ( (A.FIRST_TIME - B.FIRST_TIME) * 86400,
'SECOND'),
'HH24:MI:SS')
DURATION
FROM V$LOG_HISTORY A, V$LOG_HISTORY B, V$THREAD C
WHERE A.SEQUENCE# = B.SEQUENCE# + 1
AND A.THREAD# = C.THREAD#
AND B.THREAD# = C.THREAD#
AND A.FIRST_TIME BETWEEN TO_DATE ('23-07-2012 00:00:00',
'DD-MM-YYYY HH24:MI:SS')
AND TO_DATE ('24-07-2012 00:00:00',
'DD-MM-YYYY HH24:MI:SS')
ORDER BY 4;
Let's try it for a day, e.g. 23/07/12:
INSTANCE | THREAD# | START SEQUENCE | START TIME | END SEQUENCE | END TIME | DURATION |
OTE1 | 1 | 436571 | 22-07-12 23:59:44 | 436572 | 23-07-12 00:08:12 | 00:08:27 |
OTE2 | 2 | 402951 | 22-07-12 23:59:46 | 402952 | 23-07-12 00:15:31 | 00:15:45 |
OTE1 | 1 | 436572 | 23-07-12 00:08:12 | 436573 | 23-07-12 00:11:48 | 00:03:36 |
... | ... | ... | ... | ... | ... | ... |
OTE2 | 2 | 403315 | 23-07-12 23:57:51 | 403316 | 23-07-12 23:59:42 | 00:01:51 |
OTE1 | 1 | 436873 | 23-07-12 23:58:15 | 436874 | 23-07-12 23:59:10 | 00:00:54 |
OTE1 | 1 | 436874 | 23-07-12 23:59:10 | 436875 | 23-07-12 23:59:40 | 00:00:29 |
No comments:
Post a Comment