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 - Listar ultimo Backup generado en una Base de Datos
Oracle Spool desde sqlplus Generar resultado como tabla
#--Generar resultado como tabla separador '|' desde sqlplus
set serveroutput on size 999999
set linesize 5000
set colsep '|'
set echo on
set feedback on
set pagesize 5000
set trimspool on
set heading on
spool SALIDA_TABLA.txt;
start Consulta_Tabla.sql;
spool off
MARCACION|PROCESO|CASO|DESC|
------------|----------|----------|--------------|
9139| 706| 83741| 82499|
46722| 525| 83741| 82499|
#--Generar resultado como tabla separador ';' desde sqlplus
set serveroutput on size 999999
set colsep ';'
set echo off
set feedback on
set pagesize 32767
set trimspool on
set heading on
set trimout on
set LINESIZE 32767
spool on
spool ConsultaTabla.csv
SELECT * FROM tabla_pruebas;
spool off;
Suscribirse a:
Entradas (Atom)