Attempting to join 3 tables Status,Events and Summary

darkhorse

ADSM.ORG Member
Joined
Feb 22, 2005
Messages
59
Reaction score
0
Points
0
Website
Visit site
I have been trying to configure a query to pull data from 3 Tables but unsure if its even possible and what is the required format?
I am after:
TSM server Name
Domain
Nodename
schedule name
schedule start
schedule finish
Backup status
Size of backup
Number of Objects

I can get most out of Events Table or Summary but not all. Any suggestions?
 
select -
VARCHAR(b.server_name,10) as SERVER_NAME, -
VARCHAR(c.domain_name,16) as DOMAIN_NAME, -
VARCHAR(a.SCHEDULE_NAME,20) as SCHEDULE_NAME, -
VARCHAR(a.ENTITY,45) as STGPOOL, -
TRANSLATE('abcde fg:hi:jk', a.start_time, '_____abcde_fg_hi_jk_____',' ') AS start_time, -
TRANSLATE('abcde fg:hi:jk', a.end_time, '_____abcde_fg_hi_jk_____',' ') AS end_time, -
TRANSLATE('ab cd:ef:gh', DIGITS(a.end_time-a.start_time), '______abcdefghi_____',' ') AS duration, -
CASE -
WHEN a.bytes>1099511627776 THEN CAST(DEC(bytes)/1024/1024/1024/1024 AS DEC(5,1))||'TB' -
WHEN a.bytes>1073741824 THEN CAST(DEC(bytes)/1024/1024/1024 AS DEC(5,1))||' GB' -
WHEN a.bytes>1048576 THEN CAST(DEC(bytes)/1024/1024 AS DEC(5,1))||' MB' -
WHEN a.bytes>1024 THEN CAST(DEC(bytes)/1024 AS DEC(5,1))||' KB' -
ELSE -
CAST(a.bytes AS DEC(5,0))||' B' -
END AS bytes, -
CAST(CAST((a.bytes/1024/1024)/TIMESTAMPDIFF(2,CHAR(a.end_time-a.start_time)) -
AS DEC(6,2))AS VARCHAR(6))||' MB/s' AS THROUGHPUT, -
a.AFFECTED as FILES_BACKED_UP, -
a.SUCCESSFUL -
FROM summary a, status b, nodes c -
where a.entity in (select node_name from associations) -
and -
a.entity=c.node_name -
and -
a.activity='BACKUP' -
and -
a.start_time>=(current_timestamp - 3 days) -
order by a.start_time asc
 
Your reply helped a lot Thanks

But I have run into snag. So I am after these 2 queries to join into one. I am missing something.
If I run this:
select entity as Client,BYTES_WRITTEN as "SIZE", affected as "Objects",schedule_name,activity from summary where activity='BACKUP' and start_time>=current_timestamp - 1 hours

I get this:

CLIENT SIZE Objects SCHEDULE_NAME ACTIVITY
AIXAU2004CP2101 28,134,769 319 DAILY_INCR_1500 BACKUP


And this query:

select VARCHAR(a.server_name,10) as SERVER_NAME,NODE_NAME as Client,DOMAIN_NAME as Domain,SCHEDULE_NAME as Schedule, ACTUAL_START as "Start Time",COMPLETED as "Finish Time",Status as Status,Result as "Return Code" from status a,events where actual_start>=current_timestamp - 1 hours

this:

SERVER_NAME CLIENT DOMAIN SCHEDULE Start Time Finish Time STATUS RC
RCCPRD01 AIXAU2004CP2100 PRD_UNX DAILY_INCR_1500 2019-01-15, 15:00:19 2019-01-15, 15:00:51 Completed 4


So in this last query have joined status and events tables fine. But when attempting to join summary table details it fails. I feel I am missing something. I need to use the events table as some details are not available in summary.

In short I would like the data above to be one output: Include
SERVER_NAME CLIENT DOMAIN SCHEDULE Start Time Finish Time STATUS RC SIZE Objects Activity

Thanks
 
I have gone a bit further now. I am now getting extra records. :(

select VARCHAR(b.server_name,10) as SERVER_NAME,a.NODE_NAME as Client,a.SCHEDULE_NAME as Schedule,a.ACTUAL_START as "Start Time",a.COMPLETED as "Finish Time",c.BYTES_WRITTEN as "SIZE(GB)", c.activity from events a, status b ,summary c where a.NODE_NAME in (select node_name from associations) and c.entity=a.node_name and c.activity='BACKUP' and a.actual_start>=current_timestamp - 1 hours

results in :

SERVER_NAME CLIENT SCHEDULE Start Time Finish Time SIZE(GB) ACTIVITY
PRD01 NIM01 DAILY_INCR_1800 2019-01-15, 18:00:09 2019-01-15, 18:00:44 12,056,767 BACKUP
PRD01 NIM01 DAILY_INCR_1800 2019-01-15, 18:00:09 2019-01-15, 18:00:44 13,751,361 BACKUP


With many more rows for this one Node. NIM01

There should be only 1.

select * from events where actual_start>=current_timestamp - 1 hours

SCHEDULED_START ACTUAL_START DOMAIN_NAME SCHEDULE_NAME NODE_NAME STATUS RESULT COMPLETED
2019-01-15, 18:00:00 2019-01-15, 18:00:09 PRD DAILY_INCR_1800 NIM01 Completed 0 2019-01-15, 18:00:44



Where are these extra rows coming from?
 
The problem is that event records and summary table records don't always match when it comes to start and end times. I've dealt with this before and it means matching the records off of the node_name/entity, the schedule_name, and then matching by the start/end hour and not the full time.
 
Thanks Chad,
I think I understand. I need to somehow match part of some data for data time fields.. I will need to investigate how to achieve this. I can prove this is the case by removing the Start/End data from my query, this should result in the expected rows in the result. then somehow work out how to include it.
Thanks for your assistance.
 
Back
Top