0% found this document useful (0 votes)
171 views

Select Summary

The document contains several SQL queries that are retrieving data from a database table called "summary". The queries are retrieving data about backups, including size of backups, node names, dates and times of backups, durations, speeds, and other metadata. The queries are selecting data within certain time frames, grouping by entities, and formatting some of the returned values.

Uploaded by

Bhawna Jain
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
171 views

Select Summary

The document contains several SQL queries that are retrieving data from a database table called "summary". The queries are retrieving data about backups, including size of backups, node names, dates and times of backups, durations, speeds, and other metadata. The queries are selecting data within certain time frames, grouping by entities, and formatting some of the returned values.

Uploaded by

Bhawna Jain
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

select sum(BYTES)/1024/1024/1024 "Data_Backup GB" from summary where start_time>

(current_timestamp - 1 days) and End_Time< (current_timestamp) and ACTIVITY in (


'BACKUP','ARCHIVE') and ENTITY='______'
select entity as Node_name, cast(sum(bytes/1024/1024) as decimal (10,3)) as Tota
l_MB, substr(cast(min(start_time) as char(26)),1,19) as Date_Time, cast(substr(c
ast(max(end_time)-min(start_time) as char(20)),3, as char() as Length_min from s
ummary where start_time>=current_timestamp - 24 hours and activity='BACKUP' grou
p by entity

select start_time,end_time,char(entity,19)NODE,substr(cha r(start_time-end_time,


11),4, as Duration,char(mediaw,6)MEDIAW,char(bytes,13)BYTES, char(bytes/cast((en
d_time-start_time)seconds as decimal(18,13))/1024/1024,6)as Speed from summary w
here entity='NODENAME' and activity='BACKUP' and (end_time>current_timestamp - 2
day) order by end_time
select activity,entity, (bytes/cast(timestampdiff(2,char(end_time-start_time)) a
s decimal))/1024/1024 as MBpSec from summary where activity in ('MIGRATION','COP
Y STGPOOL')
select schedule_name, entity, start_time, end_time, substr(cast((end_time-start_
time) as char(22)),7,2) || ' ' || substr(cast((end_time-start_time) as char(22))
,9,2) || ':' || substr(cast((end_time-start_time) as char(22)),11,2) || ':' || s
ubstr(cast((end_time-start_time) as char(22)),13,2) AS ELAPSED_TIME, affected fr
om summary where activity='STGPOOL BACKUP' and timestampdiff(8, char(current_tim
estamp-start_time))<=24
select entity, CAST((START_TIME)AS DATE) AS "DATE", CAST((START_TIME)AS TIME) AS
"START TIME", CAST((END_TIME) AS TIME) AS "END TIME", timestampdiff(4, char( EN
D_TIME-START_TIME ) ) as "ELAPSED TIME", affected AS Files_Copied, cast((bytes/1
073741824) as decimal(18,2)) AS "GB BACKED UP",successful from summary where tim
estampdiff(8, char(current_timestamp-end_time))<=24 and upper(activity)='STGPOOL
BACKUP'
SELECT substr(char(start_time),1,19) AS START_TIME,timestampdiff(4,char(timestam
p(end_time ) -
(start_time))) AS ELAPTIME_IN_Minutes,cast(activity as varchar(16)) as Activity,
cast(number as varchar(16)) as Process_Number,cast(entity as varchar(30)) as
Entity,cast(float(bytes) /1024/1024/1024 AS DEC(10,2)) AS GB,cast(successful as
varchar(16)) as Successful FROM summary WHERE activity='STGPOOL BACKUP' AND
end_time>current_timestamp-48 HOURS

select ENTITY, BYTES from summary where (activity = 'BACKUP' or activity = 'REST
ORE' or activity = 'RETRIEVE' or activity = 'ARCHIVE' ) and TIMESTAMPDIFF(4,curr
ent_timestamp - end_time)<60

dateTime () {
timeStamp=$(date +'%Y-%m-%d %H:%M:%S')
theDate=$(date +'%m-%d-%Y')
theTime=$(date +'%H:%M:%S')
return
select char(COLNAME,24),char(TYPENAME,24),LENGTH,SCALE from syscat.columns where
tabname='SUMMARY' and tabschema='TSMDB1'

You might also like