zOs/SQL/CATALT
with g as
(
select ts.dbName, ts.name
, min(ts.createdTs) tCre, min(ts.alteredts) tAlt
, min(partitions) tsparts
, count(*) parts, min(p.createdTs) pCre, min(p.alteredts) pAlt
from sysibm.sysTablespace ts
join sysibm.sysTablePart p
on p.dbName = ts.dbName and p.tsname = ts.Name
-- where t.name like 'TMF1%'
group by ts.dbName, ts.name
)
select substr(name, 1, 16), tCre, tAlt, tsParts
, parts, pCre, pAlt, dbName
from g
where (tsParts <> parts and not (tsParts=0 and parts = 1))
or tCre is null or tAlt is null
or pCre is null or pAlt is null
or max(tCre, tAlt) < max(pCre, pAlt)
-- order by 2 desc
fetch first 100 rows only
;x;
select copyLasttime, r.*
from sysibm.sysTableSpaceStats r
where ( copyUpdateTime is null and copyLasttime is not null )
order by 1 desc
fetch first 100 rows only
with ur
;x;
select hex(copyUpdateLrsn), timestamp(copyUpdateLrsn || x'0000'),
copyUpdateTime, r.*
from sysibm.sysTableSpaceStats r
where ( copyUpdateTime is not null )
fetch first 100 rows only
;x;
with c as
(
select t.creator, t.name
, min(t.createdTs) tCre, min(t.alteredts) tAlt
, min(colCount) tCol
, count(*) cols, min(c.createdTs) cCre, min(c.alteredts) cAlt
from sysibm.sysTables t
join sysibm.sysColumns c
on t.creator = c.tbCreator and t.name = c.tbName
-- where t.name like 'TMF1%'
group by t.creator, t.name
)
select substr(name, 1, 16), tCre, tAlt, tCol, cols, cCre, cAlt, creator
from c
where tCol <> cols or cCre is null or cAlt is null
or max(tCre, tAlt) < max(cCre, cAlt)
-- order by 2 desc
fetch first 100 rows only
;x;
select *
from sysibm.sysTables t
where createdTs is null or t.alteredts is null
or createdTs > alteredTs
;x;