Statistical report

Several scripts
Post Reply
maheshvenu

Statistical report

Post by maheshvenu » 02 Jan 2010 11:56

Hi,
we need to get statistical report for set of jobs for every month. we used ctmstats utility to generate the report but the problem we are facing is that job names get truncated during the output.

Also we tried to extract through SQL query from the table CMR_RUNINF but again we are facing the following problem

1. We are not able to get the correct CPU_TIME and Elapsed time since both the fields are in number data type.

Can anyone advise on the issue, also let me know how the conversion is made from time to number datatype.


Thanks and regards
MaheshVenu

User avatar
Walty
Nouveau
Nouveau
Posts: 473
Joined: 20 Jan 2006 12:00

Post by Walty » 03 Jan 2010 5:27

Hi,

an example used for a similar situation:

select JOBNAME
, nodeid
, to_char(to_timestamp(trim(timestmp)
, 'YYYYMMDDHH24MISS') - numtodsinterval(elaptime / 100
, 'SECOND'), 'YYYY-MM-DD HH24:MI:SS') as start_time
, to_char(to_date(trim(timestmp), 'YYYYMMDDHH24MISS')
, 'YYYY-MM-DD HH24:MI:SS') as end_time
, substr(to_char(numtodsinterval(elaptime / 100, 'SECOND')
, 'HH24:MI'), 12, 8) as duration
from CMR_RUNINF where CMR_RUNINF.JOBNAME
like 'your_jobname'
order by jobname, start_time
Best regards
Walty

maheshvenu

Statistical report

Post by maheshvenu » 04 Jan 2010 6:30

Hi Walty,

Thanks a lot and the output is so precise...
great..

Thanks and regards
MaheshVenu

lahansen

Post by lahansen » 06 Jan 2010 11:46

Hi Walty,

yes - great.

Could you help me with adding another field too.

I would like to have data with "Avarage Elapsed time"
extracted within the same SQL.

Is that possible?

--
Lars

baralem

Post by baralem » 07 Jan 2010 1:47

You can obtain average elapsed time but not in the same query because it is a summarized value. If you add another field in select list you also must add it in group by clause.

select JOBNAME , SCHEDTAB, substr(to_char(numtodsinterval(AVG(elaptime) / 100, 'SECOND') , 'HH24:MI'), 12, 8 ) as duration
from CMR_RUNINF
where CMR_RUNINF.JOBNAME = 'your_jobname'
group by JOBNAME, SCHEDTAB
order by schedtab, jobname;

regards
martin

lahansen

Post by lahansen » 13 Jan 2010 11:48

Thanks,

as you problerly can see I am not a advanced SQL user.

Is'nt posible to combine the two SQL's so that I can have
a output that looks like this:

JOBNAME START_TIME END_TIME DURATION AVARAGE

Br.
Lars Hansen

baralem

Post by baralem » 13 Jan 2010 3:10

AVG is a group function. It means that has to be applied to a group of rows. If you need average time for each job then you have to group the row by jobname. If you check the statistics for a job the AVERAGE times are separated of job execution statistics because there are calculated using job's execution info.
I believe that it is possible to create a view that returns average execution time for each job and then join the view with the other query but average time will be the same for all the rows with the same jobname. Try something like this:

--CREATE VIEW
create view jobs_avg_time as
select JOBNAME , NODEID, substr(to_char(numtodsinterval(AVG(elaptime) / 100, 'SECOND') , 'HH24:MI'), 12, 8 ) as duration
from CMR_RUNINF
group by JOBNAME, NODEID;

--RUNINF query
select CMR_RUNINF.JOBNAME
, CMR_RUNINF.nodeid
, to_char(to_timestamp(trim(timestmp)
, 'YYYYMMDDHH24MISS') - numtodsinterval(elaptime / 100
, 'SECOND'), 'YYYY-MM-DD HH24:MI:SS') as start_time
, to_char(to_date(trim(timestmp), 'YYYYMMDDHH24MISS')
, 'YYYY-MM-DD HH24:MI:SS') as end_time
, substr(to_char(numtodsinterval(elaptime / 100, 'SECOND')
, 'HH24:MI'), 12, 8 ) as duration
, jobs_avg_time.duration as avg_duration
from CMR_RUNINF, jobs_avg_time
where CMR_RUNINF.jobname=jobs_avg_time.jobname
and CMR_RUNINF.nodeid=jobs_avg_time.nodeid
order by jobname, start_time;

baralem

Post by baralem » 14 Jan 2010 1:21

I've made a correction to the previous query. I've tested it and it works OK.

regards.
martin.

User avatar
gwr_d
Nouveau
Nouveau
Posts: 12
Joined: 25 Jan 2010 12:00

Sysout error message

Post by gwr_d » 25 Jan 2010 2:00

Hi All,

I wanted to report the sysout error message like " Unable to connect to Oracle"
Pls let me know where the sysout details are stored

Post Reply