IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PL/SQL Oracle Discussion :

sysdate next_day dans job et stats


Sujet :

PL/SQL Oracle

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    153
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 153
    Par défaut sysdate next_day dans job et stats
    bonjour,


    je dois creer un job un fois par mois ou 1 x tout les 15 jours
    en sachant que je veux que cela tombe un dimanche a 10H00

    je ne sais plus
    comment marche sysdate ou intervall

    avec ces option
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    SET SERVEROUTPUT ON
    DECLARE
      l_job  NUMBER;
    BEGIN
     
      DBMS_JOB.submit(l_job,
                      'BEGIN DBMS_STATS.gather_schema_stats(''SCOTT''); END;',
                      SYSDATE,
                      'SYSDATE + 1');
      COMMIT;
      DBMS_OUTPUT.put_line('Job: ' || l_job);
    END;

    je n arrive pas a rajouter le DBMS_STATS.gather_schema_stats
    cela prends que les percents


    je cherche ebn vain pour lancer un job
    pour lancer le job un dimanche sur 4 dans le mois a 10H00 AM

    next_day(SYSDATE,''sunday'')

    merci de votre aide

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    153
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 153
    Par défaut sysdate tache recurente 1 fois par mois
    bonjour,


    svp j ' ai un job a lancer un fois tout les 15 j
    ou 1x par mois le dimanche

    g touver cela pour chaque jour
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     
    ----------------------------------------------------------------
     
    -- ----------------------------------------------------------------
    dbms_job.submit(
       :jobno,
       'statspack.snap;',
       trunc(sysdate+1)+10/24,
       'trunc(
         least(
           next_day(SYSDATE,''SUNDAY'')
         )
        +1/24,''HH'')',
       TRUE,
       :instno);
    merci de votre aide

  3. #3
    Membre Expert Avatar de fatsora
    Profil pro
    Inscrit en
    Février 2006
    Messages
    1 103
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 1 103
    Par défaut
    Ce n'est pas tres evident a faire

    Il y a surement mieux !

    Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     
     
      DECLARE
         X NUMBER;
       BEGIN
         SYS.DBMS_JOB.SUBMIT
         ( job       => X
          ,what      => 'SCOTT.P1;'
          ,next_date => trunc(next_day (sysdate,'SUN'))
          ,interval  => 'next_day (add_months(trunc(sysdate,''MON''),1),''SUN'')'
          ,no_parse  => FALSE
        );
        SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
      COMMIT;
     END;

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    153
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 153
    Par défaut
    Citation Envoyé par fatsora Voir le message
    Ce n'est pas tres evident a faire

    Il y a surement mieux !

    Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     
     
      DECLARE
         X NUMBER;
       BEGIN
         SYS.DBMS_JOB.SUBMIT
         ( job       => X
          ,what      => 'SCOTT.P1;'
          ,next_date => trunc(next_day (sysdate,'SUN'))
          ,interval  => 'next_day (add_months(trunc(sysdate,''MON''),1),''SUN'')'
          ,no_parse  => FALSE
        );
        SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
      COMMIT;
     END;

    oki excellent le proverbe
    mais fait 3 heures que je cherche
    alors qu 'avec un scheduler cela serais déjà régler

    peux tu comenter un peu surtout l intervalle
    add_months(trunc(sysdate,''MON''),1), ?


    g testé et g un problème de cote a priori

    ORA-06550: line 2, column 6:
    PLS-00103: Encountered the symbol "1" when expecting one of the following :
    begin function package pragma procedure subtype type use
    <an identifier> <a double-quoted delimited-identifier> form
    current cursor



    voila mon script
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     DECLARE
         1 NUMBER;
       BEGIN
         SYS.DBMS_JOB.SUBMIT
         ( job       => 'BEGIN DBMS_STATS.gather_schema_stats(''SCOTT'',estimate_percent => 60); END;',
          ,what      => 'SCOTT.P1;'
          ,next_date => trunc(next_day (sysdate,'SUN'))
          ,interval  => 'next_day (add_months(trunc(sysdate,''MON''),1),''SUN'')'
          ,no_parse  => FALSE
        );
        SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(1);
      COMMIT;
     END;
    pour il me prends pas 1_job


    si c 'est pas evident alors autant le lancer selon les besoin a la mano
    peux tu me donner 2 exemple a la mano
    exemple 1 si le lance le vendredi je met sydate +2 10/24 (pour dimanche 10 heures)

    ou si je le lance le lundi pour dimanche (10h00)

  5. #5
    Membre Expert Avatar de fatsora
    Profil pro
    Inscrit en
    Février 2006
    Messages
    1 103
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 1 103
    Par défaut
    Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
     
    DECLARE
         X NUMBER;
       BEGIN
         SYS.DBMS_JOB.SUBMIT
         ( job       => X
          ,what      => 'BEGIN DBMS_STATS.gather_schema_stats('||'ownname => ''SCOTT'', cascade => TRUE, options => ''GATHER AUTO''); END;'
          ,next_date => trunc(next_day (sysdate,'SUN'))
          ,interval  => 'next_day (add_months(trunc(sysdate,''MON''),1),''SUN'')'
          ,no_parse  => FALSE
        );
        SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
      COMMIT;
     END;
    /

    Sinon add_months
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    ADD_MONTHS returns the date date plus integer months. The date argument can be a datetime value or any value that can be implicitly converted to DATE. The integer argument can be an integer or any value that can be implicitly converted to an integer. The return type is always DATE, regardless of the datatype of date. If date is the last day of the month or if the resulting month has fewer days than the day component of date, then the result is the last day of the resulting month. Otherwise, the result has the same day component as date.

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    153
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 153
    Par défaut
    Citation Envoyé par fatsora Voir le message
    Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
     
    DECLARE
         X NUMBER;
       BEGIN
         SYS.DBMS_JOB.SUBMIT
         ( job       => X
          ,what      => 'BEGIN DBMS_STATS.gather_schema_stats('||'ownname => ''SCOTT'', cascade => TRUE, options => ''GATHER AUTO''); END;'
          ,next_date => trunc(next_day (sysdate,'SUN'))
          ,interval  => 'next_day (add_months(trunc(sysdate,''MON''),1),''SUN'')'
          ,no_parse  => FALSE
        );
        SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
      COMMIT;
     END;
    /

    Sinon add_months
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    ADD_MONTHS returns the date date plus integer months. The date argument can be a datetime value or any value that can be implicitly converted to DATE. The integer argument can be an integer or any value that can be implicitly converted to an integer. The return type is always DATE, regardless of the datatype of date. If date is the last day of the month or if the resulting month has fewer days than the day component of date, then the result is the last day of the resulting month. Otherwise, the result has the same day component as date.
    ok je vais essayer faut attendre 1 mois pour voir si cela marche lol
    peut ete 1 fois tout les 15 jours c 'est plus facile

    pourquoi il plante sur X NUMBER au debut

    je met bien ce que je veux job_1 ou job_2
    j ai essayé avec 3


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    DECLARE
         3 NUMBER;
       BEGIN
         SYS.DBMS_JOB.SUBMIT
         ( job       => 3
          ,what      => 'BEGIN DBMS_STATS.gather_schema_stats('||'ownname => ''SCOTT'', cascade => TRUE, options => ''GATHER AUTO''); END;'
          ,next_date => trunc(next_day (sysdate,'SUN'))
          ,interval  => 'next_day (add_months(trunc(sysdate,''MON''),1),''SUN'')'
          ,no_parse  => FALSE
        );
        SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(3));
      COMMIT;
     END;

  7. #7
    Membre Expert Avatar de fatsora
    Profil pro
    Inscrit en
    Février 2006
    Messages
    1 103
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 1 103
    Par défaut
    Oh la , il faut voir les manules de PLSQL

    c'est une declaration de variable :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    declare
     
    v_num number 
     
    begin
    v_num := 123455;
    dbms_output.put_line (v_num);
    end;
    la doc est ici et gratuit :: tahiti.oracle.com

Discussions similaires

  1. Où trouve-t-on dans googleanalytics les stats des parametres en url ?
    Par clavier12AZQSWX dans le forum APIs Google
    Réponses: 0
    Dernier message: 21/03/2013, 23h25
  2. Biztalk 2010 et ajout mirror dans job backup
    Par Francky8 dans le forum Microsoft BizTalk Server
    Réponses: 1
    Dernier message: 19/09/2012, 11h01
  3. executer .bat dans job talend
    Par Elise0251 dans le forum Exécution et industrialisation
    Réponses: 2
    Dernier message: 16/11/2009, 09h42
  4. Créer routine et l'inserer dans job Talend
    Par gweddy dans le forum Développement de jobs
    Réponses: 5
    Dernier message: 31/03/2009, 16h07
  5. Etre notifié de l'ajout d'un job dans le spooler
    Par chtiot dans le forum API, COM et SDKs
    Réponses: 4
    Dernier message: 12/11/2003, 21h52

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo