DB2 Version 8 , zOS
SQL Statment to generate a report of a list of tablespaces and the last full image copy timestamp. If there is no full image copy, then display 'NOCOPY'
This is the piece of SQL I'd expect will do this ... But, it doesn't ... All my LAST_IC columns are 'NOCOPY'.
Code:
SELECT A.DBNAME,A.NAME,COALESCE(char(C.ITIMESTAMP),'NOCOPY') as LAST_IC
FROM
SYSIBM.SYSTABLESPACE A
LEFT OUTER JOIN
(
SELECT DBNAME,TSNAME,MAX(TIMESTAMP) AS ITIMESTAMP
FROM
SYSIBM.SYSCOPY
WHERE ICTYPE = 'F'
GROUP BY DBNAME,TSNAME
) C
ON A.DBNAME = C.DBNAME
AND A.NAME = C.TSNAME
I guess I'm missing something very silly here ...
(I do have image copies !!
SELECT DBNAME,TSNAME,MAX(TIMESTAMP) AS ITIMESTAMP
FROM
SYSIBM.SYSCOPY
WHERE ICTYPE = 'F' and DBNAME='DSNDB06'
GROUP BY DBNAME,TSNAME
fetch first 1 row only
Output is :
DSNDB06 SYSALTER 2004-05-21 13:21:47.968565
)
Any pointers ?
TIA
Sathyaram