zOs/SQL/RTSTIC
-- find reorgLastTime / timestamp
-- from tableSpaceStats, indexSpaceStats, sysCopy
-- order by db, ts partition
--
with u (db, ts, is, ty, pa, reoLa) as
(
select s.dbName, s.name ts, '', 'tss', partition, reorgLastTime
from sysibm.sysTablespace s, sysIbm.sysTableSpaceStats r
where
s.dbName = r.dbName and s.name = r.Name
and s.dbid = r.dbid and s.psid = r.psid
union all select t.dbName, t.tsName, i.indexSpace,
'iss', partition, reorgLastTime
from sysIbm.sysTables t, sysibm.sysIndexes i,
sysIbm.sysIndexSpaceStats r
where
t.dbName = i.dbName
and t.creator = i.tbCreator and t.name = i.tbName
and i.creator = r.Creator and i.name = r.Name
and i.dbid = r.dbid and i.isobid = r.isobid
union all select c.dbName, c.tsName, '', 'cop', dsNum, max(timestamp)
from sysibm.sysCopy c where icType = 'W'
group by dbName, tsName, dsNum
)
select *
from u
where db = 'MF01A1T' and ts = 'A150H'
order by 1, 2, 5, 4 desc, 3
;
x;
select s.dbName, s.name ts, indexSpace is
from sysibm.sysTablespace s, sysIbm.sysTables t, sysibm.sysIndexes i
where s.DBNAME = 'MF01A1T' and s.name like 'A150A'
and s.dbName = t.dbName and s.name = t.tsName
and s.dbName = i.dbName and s.name = t.tsName
and t.creator = i.tbCreator and t.name = i.tbName
; where
x;
select dbName, name,
oa1t.fOsFmtE7(sum(totalRows)) rows,
oa1t.fOsFmtE7(sum(space)) space,
oa1t.fOsFmtE7(sum(case when partition <= 120
then totalRows else 0 end)) rows120,
oa1t.fOsFmtE7(sum(case when partition <= 120
then space else 0 end)) space120
from sysIbm.sysTableSpaceStats
where DBNAME = 'MF01A1T' and name like 'A150%'
group by dbName, name
with ur