1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
CREATE OR REPLACE PROCEDURE sys_control
IS
-- Procédure controle BASE , envoi par mail--
jobs81 varchar2(70);
jobs42 varchar2(70);
jobs2 varchar2(70);
log varchar2(1000);
corps varchar2(2000);
objet varchar2(20) := 'controle BD PROD';
mail1 varchar2(40) := '<moi@chezmoi.com>';
de varchar2(40) := '<moi@chezmoi.com>';
BEGIN
select decode(broken,'N','okay' || ' [ ' || next_date || ' ]','planté !!!!!')
into jobs81 from DBA_JOBS where job = 81;
select decode(broken,'N','okay' || ' [ ' || next_date || ' ]','planté !!!!!')
into jobs42 from DBA_JOBS where job = 42;
select decode(broken,'N','okay' || ' [ ' || next_date || ' ]','planté !!!!!')
into jobs2 from DBA_JOBS where job = 2;
select constraint_name || '/ ' || table_name "contraintes_desactivees"--, status, last_change
into log from user_constraints where status like 'DISABLED';
corps := '<?xml version="1.0" encoding="iso-8859-15"?>'
|| '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
|| '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'
|| '<head>'
|| '</head>'
|| '<body>'
|| sysdate || '<br/>'
|| 'compte-rendu PROD' || '<br/>'
|| '<br/>'
|| 'INFORMATIQUE <br/>'
|| 'JOBS (N°) : état & prochaine exécution ' || '<br/>'
|| 'DBMS_STATS_GATHER_SCHEMA_STATS(USRIHF) (2) : ' || jobs2 || '<br/>'
|| 'mise à jour des FOREIGN KEYS (42) : ' || jobs42 || '<br/>'
|| 'mise à jour des comptes de gestion midi (81) : ' || jobs81 || '<br/>'
|| '<br/>'
|| 'CONTRAINTES DESACTIVEES ' || log || '<br/>'
|| '<br/>'
|| '</body>'
|| '</html>' ;
send_mail_4(de,mail1,objet,corps);
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END sys_control;
/ |
Partager