DB2 - Listar ultimo Backup generado en una Base de Datos

select substr(HOST_NAME,1,11) as SERVER,char(session_user,8) as INSTANCIA,char(current_server,9) as DB, substr(firstlog,1,13) as "StartLog", substr(lastlog,1,13) as "EndLog",
substr(location,1,36) as Ruta,
case(operationType)
when 'F' then 'Offline Full'
when 'N' then 'Online Full'
when 'I' then 'Offline Incremental'
when 'O' then 'Online Incremental'
when 'D' then 'Offline Delta'
when 'E' then 'Online Delta'
else '?'
end as TIPOBACKUP,
case objecttype
when 'D' then 'DataBase'
when 'P' then 'TableSpace'
when 'T' then 'Table'
end OBJETO,
date(timestamp(end_time)) as "FECHA",
time(timestamp(start_time)) as "H-INICIO",
time(timestamp(end_time)) as "H-FIN",
timestampdiff(4,char(timestamp(end_time)-timestamp(start_time))) as "TOTAL(min)",
case when (SQLCODE < 0 ) then char('ERROR',5)
else 'OK' end as Status
from SYSIBMADM.DB_HISTORY,sysibm.sysdummy1,TABLE(SYSPROC.ENV_GET_SYS_INFO())
where operation = 'B' ORDER BY "FECHA" DESC FETCH FIRST 1 ROWS ONLY;

Db2 History Backup Status



No hay comentarios: