CREATE OR REPLACE PROCEDURE SYSTEM.REGISTRA_CRECIMIENTO_BD AS
BEGIN
INSERT INTO CRECIMIENTO_BD
SELECT r.tablespace_name, reserved_space "RESERVED_SPACE(MB)",
reserved_space - free_space "USED_SPACE(MB)",
free_space "FREE_SPACE(MB)", SYSDATE
FROM (SELECT tablespace_name, SUM (BYTES)
/ (1024 * 1024) reserved_space
FROM dba_data_files
GROUP BY tablespace_name) r,
(SELECT tablespace_name, SUM (BYTES) / (1024 * 1024) free_space
FROM dba_free_space
GROUP BY tablespace_name) f, DUAL
WHERE r.tablespace_name = f.tablespace_name
ORDER BY r.tablespace_name;
COMMIT;
END;
/
Definición del job que se ejecutará automáticamente para tomar la información.
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'SYSTEM.REGISTRA_CRECIMIENTO_BD;'
,next_date => to_date('24/02/2009 00:00:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'TRUNC(SYSDATE+1)'
,no_parse => FALSE
);
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' to_char(x));
COMMIT;
END;
/
A la hora de consultar la tabla de la base de datos, podríamos observar algo así:
No hay comentarios:
Publicar un comentario
Te agradezco tus comentarios. Te esperamos de vuelta.