Précédent   Forum des professionnels en informatique > Bases de données > Oracle > Outils > Entreprise Manager
Entreprise Manager Forum d'entraide Oracle Enterprise Manager
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 22/08/2005, 09h08   #1
Rédacteur/Modérateur
 
Avatar de fadace
 
Homme Fabien Celaia
Administrateur de base de données
Inscription : octobre 2002
Messages : 3 779
Détails du profil
Informations personnelles :
Nom : Homme Fabien Celaia
Âge : 41
Localisation : Suisse

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : octobre 2002
Messages : 3 779
Points : 8 124
Points : 8 124
Envoyer un message via ICQ à fadace Envoyer un message via Skype™ à fadace
Par défaut [9i][OEM] Suppression d'un job suspendue

J'essaie désespérément de supprimer 3 travaux via OEM. Ces travaux sont donc marqués "en cours de suppression"... depuis 3 jours, mais rien ne se passe... malgré le redémarrage du serveurs Windows.

Seuls les jobs touchant l'instance comprenant la base référentielle et l'OEM sont problématiques : les jobs gérés par le même OEM, mais touchant d'autres instances ont un comportement normal.

OEM semble - à part ça - se comporter tout à fait normalement ; les agents sont démarrés sur les machines et ne semblent pas avoir de soucis.

Une idée ???
__________________
Sr DBA Oracle / Sybase / MS-SQL / DB2 / Informix / Postgresql
Administrateur SAP
Mes articles

Attention : pas de réponse technique par MP : pensez aux autres, passez par les forums !
fadace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/08/2005, 09h12   #2
Membre expérimenté
 
Homme Didier Duchossoir
Administrateur de base de données
Inscription : mars 2003
Messages : 578
Détails du profil
Informations personnelles :
Nom : Homme Didier Duchossoir
Localisation : France, Hauts de Seine (Île de France)

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : mars 2003
Messages : 578
Points : 528
Points : 528
Bonjour,

Est-ce que les travaux avaient été créés par OEM?
Si non, il est préférable d' utiliser dbms_job car oem a dû mal à gerer
les jobs dont il n' est pas le créateur .

Cdlt
ducho est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/08/2005, 09h15   #3
Rédacteur/Modérateur
 
Avatar de fadace
 
Homme Fabien Celaia
Administrateur de base de données
Inscription : octobre 2002
Messages : 3 779
Détails du profil
Informations personnelles :
Nom : Homme Fabien Celaia
Âge : 41
Localisation : Suisse

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : octobre 2002
Messages : 3 779
Points : 8 124
Points : 8 124
Envoyer un message via ICQ à fadace Envoyer un message via Skype™ à fadace
oui, tout a été créé via OEM, et ce genre de suppression est courant chez nous... normalement sans problème....
__________________
Sr DBA Oracle / Sybase / MS-SQL / DB2 / Informix / Postgresql
Administrateur SAP
Mes articles

Attention : pas de réponse technique par MP : pensez aux autres, passez par les forums !
fadace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/08/2005, 15h55   #4
Membre expérimenté
 
Homme Didier Duchossoir
Administrateur de base de données
Inscription : mars 2003
Messages : 578
Détails du profil
Informations personnelles :
Nom : Homme Didier Duchossoir
Localisation : France, Hauts de Seine (Île de France)

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : mars 2003
Messages : 578
Points : 528
Points : 528
dans quel état sont-ils dans dba_jobs ?
ducho est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 11h42   #5
Rédacteur/Modérateur
 
Avatar de fadace
 
Homme Fabien Celaia
Administrateur de base de données
Inscription : octobre 2002
Messages : 3 779
Détails du profil
Informations personnelles :
Nom : Homme Fabien Celaia
Âge : 41
Localisation : Suisse

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : octobre 2002
Messages : 3 779
Points : 8 124
Points : 8 124
Envoyer un message via ICQ à fadace Envoyer un message via Skype™ à fadace
Toutes mes tables dba_jobs sont ... vides C'est quoi cette table de
__________________
Sr DBA Oracle / Sybase / MS-SQL / DB2 / Informix / Postgresql
Administrateur SAP
Mes articles

Attention : pas de réponse technique par MP : pensez aux autres, passez par les forums !
fadace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 12h06   #6
Rédacteur/Modérateur
 
Inscription : janvier 2005
Messages : 2 320
Détails du profil
Informations forums :
Inscription : janvier 2005
Messages : 2 320
Points : 2 368
Points : 2 368
Cette table concerne les jobs Oracle et ne sont pas des Job de surveillance OEM.
Est ce que l'agent est démarré sur le noeud ou est installé ton OEM ,si oui quel est son statut
Jaouad est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 12h18   #7
Rédacteur
 
Avatar de bouyao
 
Inscription : janvier 2005
Messages : 1 778
Détails du profil
Informations forums :
Inscription : janvier 2005
Messages : 1 778
Points : 1 857
Points : 1 857
Essaye ce script de metalink
Citation:
This script will cleanup scheduled / deleted jobs, delete events and cleanup
pending deletion
Code :
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
--  -----------------------------------------------------------
--  SMP_VDT_METRIC_ROLLUP: Package
--  -----------------------------------------------------------
 
CREATE OR REPLACE PACKAGE dbms_oem AS
 
  PROCEDURE PurgeJobs  ( sdate IN DATE, opt IN NUMBER );
  PROCEDURE PurgeEvents( sdate IN DATE, opt IN NUMBER );
 
END dbms_oem;
/
 
--  -----------------------------------------------------------
--  SMP_VDT_METRIC_ROLLUP: Package Body
--  -----------------------------------------------------------
 
CREATE OR REPLACE PACKAGE BODY dbms_oem AS
 
  -- 
  -- FUNCTION: PurgeJobs
  --
  --   Archive all completed/failed jobs to the SMP_VDJ_JOB_ARCHIVE table
  --     *  Records with status 1 are not archived (The beginning)
  --        Reason: Am I allowed to do so?
  --     *  If the table SMP_VDJ_ARCHIVED_JOBS exist, and opt is set to 1, the 
  --        archived job records will be stored in this table
  --
  PROCEDURE PurgeJobs (sdate IN DATE, opt IN NUMBER) IS
    archive_jobs NUMBER;
    vdu_id       NUMBER;
 
    CURSOR c1(sdate DATE) IS
      SELECT j.job_id, j.job_name, j.owner, j.description, h1.exec_num, jpt.target_name, jpt.target_type, jpt.node_name, h1.timestamp bdate, h2.timestamp edate, h2.STATUS
      FROM   smp_vdj_job j, smp_vdj_job_per_target jpt, 
             (SELECT job_id, target_name, exec_num, MIN(time_stamp+time_zone/86400000) "TIMESTAMP"
              FROM   smp_vdj_job_log 
              WHERE  time_stamp+time_zone/86400000 < sdate 
                AND  STATUS = 4 
              GROUP BY job_id, target_name, exec_num) h1,
             (SELECT job_id, target_name, exec_num, MAX(time_stamp+time_zone/86400000) "TIMESTAMP", MAX(STATUS) STATUS 
              FROM   smp_vdj_job_log 
              WHERE  time_stamp+time_zone/86400000 < sdate 
                AND  (STATUS >= 9 AND STATUS NOT IN (13,16,17))
              GROUP BY job_id, target_name, exec_num) h2
      WHERE  j.job_id = jpt.job_id
        AND  j.job_id = h1.job_id
        AND  j.job_id = h2.job_id
        AND  jpt.target_name = h1.target_name
        AND  jpt.target_name = h2.target_name
        AND  h1.exec_num = h2.exec_num
      ;
 
 
    CURSOR c2 IS
      SELECT job_id 
      FROM   smp_vdj_job j 
      WHERE  is_lib = 0
        AND  NOT EXISTS (
                 SELECT job_id 
                 FROM   smp_vdj_job_per_target
                 WHERE  job_id = j.job_id)
      ;
 
    CURSOR c3(sdate DATE) IS
      SELECT h1.job_id, h1.target_name, h1.exec_num
      FROM   (SELECT job_id, target_name, exec_num
              FROM   smp_vdj_job_log 
              WHERE  time_stamp+time_zone/86400000 < sdate
                AND  STATUS = 2
              GROUP BY job_id, target_name, exec_num) h1,
             (SELECT job_id, target_name, exec_num
              FROM   smp_vdj_job_log 
              WHERE  time_stamp+time_zone/86400000 < sdate
                AND  (STATUS >= 9 AND STATUS NOT IN (13,16,17))
              GROUP BY job_id, target_name, exec_num) h2
      WHERE  h1.job_id = h2.job_id
        AND  h1.target_name = h2.target_name
        AND  h1.exec_num = h2.exec_num
      ;
 
    CURSOR c4(sdate DATE) IS
      SELECT m1.job_id, m1.target_name, m1.exec_num
      FROM   (SELECT job_id, target_name, exec_num, MIN(STATUS) m1
              FROM   smp_vdj_job_log
              WHERE  time_stamp+time_zone/86400000 < sdate
                AND  STATUS > 4
              GROUP BY job_id, target_name, exec_num) m1,
             (SELECT job_id, target_name, exec_num, MAX(STATUS) m2
              FROM   smp_vdj_job_log
              WHERE  time_stamp+time_zone/86400000 < sdate
                AND  STATUS > 4
              GROUP BY job_id, target_name, exec_num) m2
      WHERE  m1.job_id = m2.job_id
        AND  m1.target_name = m2.target_name
        AND  m1.exec_num = m2.exec_num
        AND  m1.m1 = m2.m2;
 
    CURSOR c5(sdate DATE) IS
      SELECT jl.job_id, jl.target_name, jl.exec_num
      FROM   smp_vdj_job_log jl, smp_vdj_job j, smp_vdn_target_type_defn ttd
      WHERE  jl.time_stamp+jl.time_zone/86400000 < sdate
        AND  jl.job_id = j.job_id
        AND  j.target_type = ttd.name
        AND  (jl.target_name,ttd.id) NOT IN (SELECT name, typeid FROM smp_vdn_target_list);
 
  BEGIN
    archive_jobs := 0;
 
    IF opt = 1 THEN
       SELECT COUNT(*)
       INTO   archive_jobs
       FROM   user_tables
       WHERE  table_name = 'SMP_VDJ_ARCHIVED_JOBS';
    END IF;
 
    FOR c1_rec IN c1(sdate) LOOP
    BEGIN
       IF archive_jobs = 1 THEN
          INSERT INTO smp_vdj_archived_jobs (job_id, job_name, exec_num, job_desc, owner, target_name, target_type, node_name, start_time, stop_time, STATUS)
                 VALUES(c1_rec.job_id,c1_rec.job_name,c1_rec.exec_num,c1_rec.description,c1_rec.owner,c1_rec.target_name,c1_rec.target_type,c1_rec.node_name,c1_rec.bdate,c1_rec.edate,c1_rec.STATUS);
 
END IF;
 
       DELETE FROM smp_vdj_job_output
         WHERE blob_id IN (SELECT output_id
                           FROM   smp_vdj_job_log
                           WHERE  job_id      = c1_rec.job_id
                             AND  target_name = c1_rec.target_name
                             AND  exec_num    = c1_rec.exec_num);
 
       DELETE FROM smp_vdj_job_log
         WHERE job_id      = c1_rec.job_id
           AND target_name = c1_rec.target_name
           AND exec_num    = c1_rec.exec_num;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name        = c1_rec.job_id
           AND execnum     = c1_rec.exec_num
           AND target      = c1_rec.target_name
           AND type        = 1;
 
       COMMIT;
    END;
    END LOOP;
 
    -- Next, remove jobs which got scheduled, but never ran, and got deleted
    FOR c3_rec IN c3(sdate) LOOP
    BEGIN
       DELETE FROM smp_vdj_job_log
         WHERE job_id      = c3_rec.job_id
           AND target_name = c3_rec.target_name
           AND exec_num    = c3_rec.exec_num;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name        = c3_rec.job_id
           AND execnum     = c3_rec.exec_num
           AND target      = c3_rec.target_name
           AND type        = 1;
 
       COMMIT;
    END;
    END LOOP;
 
    -- Next, clean up orphaned job execution records.
    -- Any solitary record which a completed status for a job execution is a 
    -- leftover after a job truncate history
    FOR c4_rec IN c4(sdate) LOOP
    BEGIN
       DELETE FROM smp_vdj_job_log
         WHERE job_id      = c4_rec.job_id
           AND target_name = c4_rec.target_name
           AND exec_num    = c4_rec.exec_num;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name        = c4_rec.job_id
           AND execnum     = c4_rec.exec_num
           AND target      = c4_rec.target_name
           AND type        = 1;
 
       COMMIT;
    END;
    END LOOP;
 
    -- Finally, remove all job leftovers for targets that no longer exist
    FOR c5_rec IN c5(sdate) LOOP
    BEGIN
       DELETE FROM smp_vdj_job_log
         WHERE job_id      = c5_rec.job_id
           AND target_name = c5_rec.target_name
           AND exec_num    = c5_rec.exec_num;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name        = c5_rec.job_id
           AND execnum     = c5_rec.exec_num
           AND target      = c5_rec.target_name
           AND type        = 1;
 
       COMMIT;
    END;
    END LOOP;
 
    -- Remove ghost jobs
    DELETE FROM smp_vdj_job_log jl 
      WHERE jl.time_stamp+jl.time_zone/86400000 < sdate
        AND (jl.job_id, jl.target_name) IN (SELECT job_id, target_name FROM smp_vdj_job_per_target WHERE STATUS = 14 OR STATUS = 15)
    ;
    DELETE FROM smp_vdj_job_per_target 
      WHERE (STATUS = 14 OR STATUS = 15)
        AND (job_id, target_name) NOT IN (SELECT DISTINCT job_id, target_name FROM smp_vdj_job_log)
    ;
    COMMIT;
 
    -- Now clean up all remainders for jobs which no longer contain info
    FOR c2_rec IN c2 LOOP
    BEGIN
      DELETE FROM smp_vdm_notification_details
        WHERE name = c2_rec.job_id
          AND type = 1;
 
      DELETE FROM smp_vdj_job_log jl 
        WHERE job_id = c2_rec.job_id;
 
      DELETE FROM smp_vdj_job 
        WHERE job_id = c2_rec.job_id;
 
      DELETE FROM smp_vdi_pos 
        WHERE type = 'JOB' 
          AND id   = c2_rec.job_id;
 
      DELETE FROM smp_vdi_target_properties 
        WHERE object_type = 'JOB'
          AND object_id   = c2_rec.job_id;
 
      DELETE FROM smp_vdi_object_table 
        WHERE type        = 'JOB'
          AND object_name = c2_rec.job_id;
 
      BEGIN
        SELECT object_id 
        INTO   vdu_id
        FROM   smp_vdu_objects_table
        WHERE  type        = 'JOB'
          AND  object_name = c2_rec.job_id;
 
        DELETE FROM smp_vdu_privilege_table 
          WHERE object_oid = vdu_id;
 
        DELETE FROM smp_vdu_objects_table 
          WHERE object_id = vdu_id;
      EXCEPTION
        WHEN no_data_found THEN
             NULL;
        WHEN others THEN
             raise;
      END;
 
      COMMIT;
    END;
    END LOOP;
 
    COMMIT;
  END PurgeJobs;
 
  -- 
  -- FUNCTION: PurgeEvents
  --
  --   Archive all closed event notifications
  --     *  Only notifications, in the event history with status 15 are archived
  --     *  If the table SMP_VDE_ARCHIVED_EVENTS exist, and opt is set to 1, the 
  --        archived notification records will be stored in this table
  --     *  Cleanup the ISIS tables while cleaning up the events
  --
  PROCEDURE PurgeEvents (sdate IN DATE, opt IN NUMBER) IS
    archive_events NUMBER;
    vdu_id         NUMBER;
 
    open_time      DATE;
    close_time     DATE;
    time_warning   NUMBER;
    time_critical  NUMBER;
    time_error     NUMBER;
    time_down      NUMBER;
    time_unknown   NUMBER;
 
    isis_id        VARCHAR2(128);
 
    historyPresent EXCEPTION;
 
    CURSOR c1(sdate DATE) IS
      SELECT e.id, eo.event_occurrence_id, e.name, e.description, e.owner, eo.node_name, eo.target_name, eo.target_type, el.timestamp
      FROM   smp_vde_event e, smp_vde_event_target_info ti, smp_vde_event_occurrence eo,
             (SELECT event_occurrence_id, MAX(timestamp+timezone/86400000) timestamp FROM smp_vde_event_log GROUP BY event_occurrence_id) el
      WHERE  e.id = eo.event_id
        AND  eo.event_occurrence_id = el.event_occurrence_id
        AND  e.id = ti.event_id
        AND  eo.target_name = ti.target_name
        AND  eo.target_type = ti.target_type
        AND  (eo.severity = 15 OR ti.agent_status = 208)
        AND  eo.STATUS = 0
        AND  el.timestamp < sdate
    ;
 
    CURSOR c2(e_id NUMBER, occ_id NUMBER) IS
      SELECT   '/'||NVL(d.company,'oracle')||'/'||NVL(d.organization,'host')||'/'||NVL(d.product,'fault')||'/'||NVL(d.filename,'updown')
event_test, l.timestamp+l.timezone/86400000 timestamp, l.severity, l.event_test_severity, l.author, l.ENTRY
      FROM     smp_vde_event_log l, smp_vde_event_details d
      WHERE    l.event_occurrence_id = occ_id
        AND    l.event_test_id = d.test_id (+)
        AND    e_id = d.event_id (+)
      ORDER BY timestamp DESC
      ;
 
    CURSOR c3 IS
      SELECT id 
      FROM   smp_vde_event e 
      WHERE  is_library='N'
        AND  NOT EXISTS (
                 SELECT event_id 
                 FROM   smp_vde_event_target_info
                 WHERE  event_id = e.id
                   AND  agent_status != 208)
        AND  NOT EXISTS (
                 SELECT event_id
                 FROM   smp_vde_event_occurrence
                 WHERE  event_id = e.id)
      ;
 
  BEGIN
    archive_events := 0;
 
    IF opt = 1 THEN
       SELECT COUNT(*)
       INTO   archive_events
       FROM   user_tables
       WHERE  table_name = 'SMP_VDE_ARCHIVED_EVENTS';
    END IF;
 
    FOR c1_rec IN c1(sdate) LOOP
    BEGIN
       IF archive_events = 1 THEN
          open_time     := c1_rec.timestamp;
          close_time    := c1_rec.timestamp;
          time_warning  := 0;
          time_critical := 0;
          time_error    := 0;
          time_down     := 0;
          time_unknown  := 0;
 
          FOR c2_rec IN c2(c1_rec.id,c1_rec.event_occurrence_id) LOOP
          BEGIN
              IF c2_rec.severity <> -1 THEN
                 IF c2_rec.severity = 18 THEN
                    time_error := time_error + (open_time-c2_rec.timestamp);
                 ELSE
                    IF c2_rec.severity = 20 THEN
                       time_warning := time_warning + (open_time-c2_rec.timestamp);
                    ELSE
                       IF c2_rec.severity = 25 THEN
                          time_critical := time_critical + (open_time-c2_rec.timestamp);
                       ELSE
                         IF c2_rec.severity = 303 THEN
                            time_down := time_down + (open_time-c2_rec.timestamp);
                         ELSE
                            IF c2_rec.severity <> 15 THEN
                               time_unknown := time_unknown + (open_time-c2_rec.timestamp);
                            END IF;
                         END IF;
                       END IF;
                    END IF;
                 END IF;
                 open_time := c2_rec.timestamp;
              END IF;
              INSERT INTO smp_vde_archived_event_logs (occurrence_id, event_test, timestamp, severity, test_severity, author, message)
                     VALUES
(c1_rec.event_occurrence_id, c2_rec.event_test, c2_rec.timestamp, c2_rec.severity, c2_rec.event_test_severity, c2_rec.author, c2_rec.entry);
          END;
          END LOOP;
 
          INSERT INTO smp_vde_archived_events (event_id, occurrence_id, event_name,
event_desc, owner, node_name, target_name, target_type, open_time, close_time, time_warning, time_critical, time_down, time_error, time_unknown)
                 VALUES (c1_rec.id, c1_rec.event_occurrence_id,
c1_rec.name, c1_rec.description, c1_rec.owner, c1_rec.node_name, c1_rec.target_name, c1_rec.target_type, open_time, close_time, time_warning, time_critical, time_down, time_error, time_unknown);
       END IF;
 
       DELETE FROM smp_vde_event_occurrence
         WHERE event_occurrence_id = c1_rec.event_occurrence_id;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name    = c1_rec.id
           AND execnum = c1_rec.event_occurrence_id
           AND type    = 2;
 
       COMMIT;
    END;
    END LOOP;
 
    -- Remove ghost events
    FOR c3_rec IN c3 LOOP
    BEGIN
       DELETE FROM smp_vdm_notification_details
         WHERE name = c3_rec.id
           AND type = 2;
 
       DELETE FROM smp_vde_event 
         WHERE id = c3_rec.id;
 
       DELETE FROM smp_vdi_pos 
         WHERE type = 'EVENT'
           AND id   = c3_rec.id;
 
       DELETE FROM smp_vdi_target_properties
         WHERE object_type = 'EVENT'
           AND object_id   = c3_rec.id;
 
       DELETE FROM smp_vdi_object_table
         WHERE type        = 'EVENT'
           AND object_name = TO_CHAR(c3_rec.id);
 
       BEGIN
          SELECT object_id 
          INTO   vdu_id
          FROM   smp_vdu_objects_table
          WHERE  object_name = TO_CHAR(c3_rec.id)
            AND  type        = 'EVENT';
 
          DELETE FROM smp_vdu_privilege_table
             WHERE object_oid = vdu_id;
 
          DELETE FROM smp_vdu_objects_table
             WHERE object_id = vdu_id;
       EXCEPTION
          WHEN no_data_found THEN
               NULL;
       END;
 
       COMMIT;
    EXCEPTION
       WHEN historyPresent THEN
            vdu_id := 0;
       WHEN others THEN
            RAISE;
    END;
    END LOOP;
 
    COMMIT;
  END PurgeEvents;
 
END dbms_oem;
/
bouyao est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 13h24   #8
Rédacteur/Modérateur
 
Avatar de fadace
 
Homme Fabien Celaia
Administrateur de base de données
Inscription : octobre 2002
Messages : 3 779
Détails du profil
Informations personnelles :
Nom : Homme Fabien Celaia
Âge : 41
Localisation : Suisse

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : octobre 2002
Messages : 3 779
Points : 8 124
Points : 8 124
Envoyer un message via ICQ à fadace Envoyer un message via Skype™ à fadace
L'agent est up & running
Code :
1
2
3
4
5
6
7
8
9
10
C:\oracle\9i\bin>agentctl.exe STATUS
 
DBSNMP FOR 32-bit Windows: Version 9.2.0.6.0 - Production ON 24-AOU-2005 13:22:31
 
Copyright (c) 2003 Oracle Corporation.  ALL rights reserved.
 
Version             : DBSNMP FOR 32-bit Windows: Version 9.2.0.6.0 - Production
Répertoire d'origine Oracle Home         : c:\oracle\9i
Démarré par l'utilisateur     : SYSTEM
L'agent est en cours d'exécution depuis lundi 22.août 2005 15:25:36
Pour ce qui est du script, ça ne m'enchante pas de supprimer tous les événements, surtout que la plupart (ceux qui ne pointent pas sur mon serveur) marchent.
__________________
Sr DBA Oracle / Sybase / MS-SQL / DB2 / Informix / Postgresql
Administrateur SAP
Mes articles

Attention : pas de réponse technique par MP : pensez aux autres, passez par les forums !
fadace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 13h30   #9
Rédacteur
 
Avatar de bouyao
 
Inscription : janvier 2005
Messages : 1 778
Détails du profil
Informations forums :
Inscription : janvier 2005
Messages : 1 778
Points : 1 857
Points : 1 857
Tu peut utiliser que PurgeJobs si PurgeEvents ça ne t'enchante pas .
bouyao est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 13h46   #10
Rédacteur/Modérateur
 
Inscription : janvier 2005
Messages : 2 320
Détails du profil
Informations forums :
Inscription : janvier 2005
Messages : 2 320
Points : 2 368
Points : 2 368
as tu tenté un raffraissement du node ?
Jaouad est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 14h04   #11
Rédacteur
 
Avatar de bouyao
 
Inscription : janvier 2005
Messages : 1 778
Détails du profil
Informations forums :
Inscription : janvier 2005
Messages : 1 778
Points : 1 857
Points : 1 857
Voila un petit cours
Pour casser un job il faut savoir l'identifier
Code :
SELECT sid,job,failures,to_char(last_date,'DD/MM HH24:MI') FROM dba_jobs_running;
la colonne sid donne le numéro de la session. la commande
Code :
ALTER system KILL session
permet de supprimer une session.
La colonne job donne le numéro qui sera utilisé pour casser son execution.
Pour cela on utilise la procedure dbms_broken()
exemple :
Code :
execute dbms_job.broken(20);
Citation:
Attention un job cassé reste dans la file d'attente
Pour le supprimer il suffit de l'identifier dans la vue DBA_JOBS puis faire appel à la procedure dbms_job_remove()
par exemple :
Code :
execute dbms_job.remove(20);
[/b]
bouyao est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 15h23   #12
Rédacteur/Modérateur
 
Avatar de fadace
 
Homme Fabien Celaia
Administrateur de base de données
Inscription : octobre 2002
Messages : 3 779
Détails du profil
Informations personnelles :
Nom : Homme Fabien Celaia
Âge : 41
Localisation : Suisse

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : octobre 2002
Messages : 3 779
Points : 8 124
Points : 8 124
Envoyer un message via ICQ à fadace Envoyer un message via Skype™ à fadace
Que ce soit dba_jobs ou dba_jobs_running, elles sont totalement vides !!!
__________________
Sr DBA Oracle / Sybase / MS-SQL / DB2 / Informix / Postgresql
Administrateur SAP
Mes articles

Attention : pas de réponse technique par MP : pensez aux autres, passez par les forums !
fadace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/08/2005, 15h39   #13
Rédacteur
 
Avatar de bouyao
 
Inscription : janvier 2005
Messages : 1 778
Détails du profil
Informations forums :
Inscription : janvier 2005
Messages : 1 778
Points : 1 857
Points : 1 857
Ok j'ai compris,
tu a des orphelins c.a.d. dans le repository de OEM tu a des jobs qui sont toujours en mode deleting comme il ne trouve pas d'entrée dans le noeud alors ils resterons toujours en mode deleting.
Pour cela il y'a un script de metalink qui resoud ton problème
Code :
DBMS_OEM.ShowOrphanHosts
pour voir les orphelins et pour nettoyer ces orphelins
je donne le script ici :
Code :
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
 
-- 
--  NAME
--	dbms_oem.sql - EM 9i version
--
--	Copyright (c) 1996, 2004 by Oracle Corporation
--
--  FUNCTION
--	Create PL/SQL routines for EM administration
--
--  NOTES
--
--	17-NOV-2004  wgruyter  ShowOrphanHosts added
--	15-NOV-2004  wgruyter  CheckPendingDeleteJobs added
--	03-MAR-2004  wgruyter  Incomplete run addition
--	03-NOV-2003  wgruyter  Fix in joblog incomplete runs
--	02-OCT-2003  wgruyter  PurgeHostname added
--	18-JUN-2003  wgruyter  Statistics added
--	25-NOV-2002  wgruyter  PurgeOperations added
--	18-OCT-2002  wgruyter  Export Cleanup / FixHostnameChange
--	11-OCT-2002  wgruyter  CheckPendingDeleteEvents / CheckNodeUpdown
--	10-OCT-2002  wgruyter  PurgeOperations added
--	13-AUG-2002  wgruyter  PurgeSLR added
--	15-JUL-2002  wgruyter  Removing orphan job output
--	10-DEC-2001  wgruyter  Made 9i ready
--	17-SEP-2001  wgruyter  Added deleted events to be archived
--	26-MAR-2001  wgruyter  Creation of script
-- 
 
--  -----------------------------------------------------------
--  DBMS_OEM: Package
--  -----------------------------------------------------------
 
CREATE OR REPLACE PACKAGE dbms_oem AS
 
  PROCEDURE PurgeJobs  ( sdate IN DATE, opt IN NUMBER );
  PROCEDURE PurgeEvents( sdate IN DATE, opt IN NUMBER );
  PROCEDURE PurgeSLR;
  PROCEDURE PurgeOperations;
  PROCEDURE PurgeExpertTables;
  PROCEDURE PurgeExpertSession ( databaseID IN NUMBER );
  PROCEDURE PurgeHostname      ( old_name IN VARCHAR2 );
 
  PROCEDURE CheckPendingDeleteEvents;
  PROCEDURE CheckPendingDeleteHosts;
  PROCEDURE CheckPendingDeleteJobs;
  PROCEDURE CheckNodeUpdown;
 
  PROCEDURE FixHostnameChange  ( old_name IN VARCHAR2, new_name IN VARCHAR2 );
  PROCEDURE ShowOrphanHosts;
 
  PROCEDURE Statistics;
 
  --PROCEDURE ResetSYSMAN;
 
END dbms_oem;
/
 
--  -----------------------------------------------------------
--  DBMS_OEM: Package Body
--  -----------------------------------------------------------
 
CREATE OR REPLACE PACKAGE BODY dbms_oem AS
 
  -- 
  -- FUNCTION: PurgeJobs
  --
  --   Archive all completed/failed jobs to the SMP_VDJ_JOB_ARCHIVE table
  --     *  Records with status 1 are not archived (The beginning)
  --        Reason: Am I allowed to do so?
  --     *  If the table SMP_VDJ_ARCHIVED_JOBS exist, and opt is set to 1, the 
  --        archived job records will be stored in this table
  --
  PROCEDURE PurgeJobs (sdate IN DATE, opt IN NUMBER) IS
    archive_jobs NUMBER;
    vdu_id       NUMBER;
 
    CURSOR c1(sdate DATE) IS
      SELECT j.job_id, j.job_name, j.owner, j.description, h1.exec_num, jpt.target_name, jpt.target_type, jpt.node_name, h1.timestamp bdate, h2.timestamp edate, h2.STATUS
      FROM   smp_vdj_job j, smp_vdj_job_per_target jpt, 
             (SELECT job_id, target_name, exec_num, MIN(time_stamp+time_zone/86400000) "TIMESTAMP"
              FROM   smp_vdj_job_log 
              WHERE  time_stamp+time_zone/86400000 < sdate 
                AND  STATUS = 4 
              GROUP BY job_id, target_name, exec_num) h1,
             (SELECT job_id, target_name, exec_num, MAX(time_stamp+time_zone/86400000) "TIMESTAMP", MAX(STATUS) STATUS 
              FROM   smp_vdj_job_log 
              WHERE  time_stamp+time_zone/86400000 < sdate 
                AND  (STATUS >= 9 AND STATUS NOT IN (13,16,17))
              GROUP BY job_id, target_name, exec_num) h2
      WHERE  j.job_id = jpt.job_id
        AND  j.job_id = h1.job_id
        AND  j.job_id = h2.job_id
        AND  jpt.target_name = h1.target_name
        AND  jpt.target_name = h2.target_name
        AND  h1.exec_num = h2.exec_num
      ;
 
 
    CURSOR c2 IS
      SELECT job_id 
      FROM   smp_vdj_job j 
      WHERE  is_lib = 0
        AND  NOT EXISTS (
                 SELECT job_id 
                 FROM   smp_vdj_job_per_target
                 WHERE  job_id = j.job_id)
      ;
 
    CURSOR c3(sdate DATE) IS
      SELECT job_id, target_name, exec_num, MAX(STATUS)
      FROM   smp_vdj_job_log
      WHERE  exec_num != 0
        AND  time_stamp+time_zone/86400000 < sdate
      GROUP BY job_id, target_name, exec_num HAVING ((MIN(STATUS)!=4) AND (MAX(STATUS)>=9))
      ;
 
    CURSOR c4(sdate DATE) IS
      SELECT j1.job_id, j1.target_name, j1.exec_num
      FROM   (SELECT job_id, target_name, exec_num, MIN(time_stamp) tstamp, MIN(STATUS) min_s, MAX(STATUS) max_s
              FROM   smp_vdj_job_log
              WHERE  exec_num != 0
                AND  time_stamp < sdate
              GROUP BY job_id, target_name, exec_num) j1
      WHERE  EXISTS
             (SELECT 'x'
              FROM   smp_vdj_job_log j2
              WHERE  j2.job_id = j1.job_id
                AND  j2.target_name = j1.target_name
                AND  j2.exec_num > j1.exec_num)
      ;
 
  BEGIN
    archive_jobs := 0;
 
    IF opt = 1 THEN
       SELECT COUNT(*)
       INTO   archive_jobs
       FROM   user_tables
       WHERE  table_name = 'SMP_VDJ_ARCHIVED_JOBS';
    END IF;
 
    FOR r1 IN c1(sdate) LOOP
    BEGIN
       IF archive_jobs = 1 THEN
          INSERT INTO smp_vdj_archived_jobs (job_id, job_name, exec_num, job_desc, owner, target_name, target_type, node_name, start_time, stop_time, STATUS)
                 VALUES(r1.job_id,r1.job_name,r1.exec_num,r1.description,r1.owner,r1.target_name,r1.target_type,r1.node_name,r1.bdate,r1.edate,r1.STATUS);
       END IF;
 
       DELETE FROM smp_vdj_job_output
         WHERE blob_id IN (SELECT output_id
                           FROM   smp_vdj_job_log
                           WHERE  job_id      = r1.job_id
                             AND  target_name = r1.target_name
                             AND  exec_num    = r1.exec_num);
 
       DELETE FROM smp_vdj_job_log
         WHERE job_id      = r1.job_id
           AND target_name = r1.target_name
           AND exec_num    = r1.exec_num;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name        = r1.job_id
           AND execnum     = r1.exec_num
           AND target      = r1.target_name
           AND type        = 1;
 
       COMMIT;
    END;
    END LOOP;
 
    -- Remove ghost jobs
    DELETE FROM smp_vdj_job_log jl 
      WHERE exec_num=0 
        AND 1 = (SELECT COUNT(*) FROM smp_vdj_job_log WHERE job_id = jl.job_id AND target_name = jl.target_name)
        AND (jl.job_id, jl.target_name) IN (SELECT job_id, target_name FROM smp_vdj_job_per_target WHERE STATUS = 14 OR STATUS = 15)
    ;
 
    DELETE FROM smp_vdj_job_per_target jpt
      WHERE (jpt.STATUS = 14 OR jpt.STATUS = 15)
        AND NOT EXISTS
            (SELECT 'x'
             FROM   smp_vdj_job_log
             WHERE  job_id = jpt.job_id
               AND  target_name = jpt.target_name)
    ;
 
    COMMIT;
 
    -- Remove incomplete runs
    FOR r3 IN c3(sdate) LOOP
    BEGIN
       DELETE FROM smp_vdj_job_log
         WHERE job_id      = r3.job_id
           AND target_name = r3.target_name
           AND exec_num    = r3.exec_num;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name        = r3.job_id
           AND execnum     = r3.exec_num
           AND target      = r3.target_name
           AND type        = 1;
 
       COMMIT;
    END;
    END LOOP;
 
    FOR r4 IN c4(sdate-1) LOOP
    BEGIN
       DELETE FROM smp_vdj_job_log
         WHERE job_id      = r4.job_id
           AND target_name = r4.target_name
           AND exec_num    = r4.exec_num;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name        = r4.job_id
           AND execnum     = r4.exec_num
           AND target      = r4.target_name
           AND type        = 1;
 
       COMMIT;
    END;
    END LOOP;
 
    -- Remove orphan job output
    DELETE FROM smp_vdj_job_output
    WHERE  blob_id IN 
           (SELECT blob_id 
            FROM   smp_vdj_job_output jo, smp_vdj_job_log jl
            WHERE  jo.blob_id = jl.output_id (+)
              AND  jl.output_id IS NULL);
 
    COMMIT;
 
    -- Remove orphan job notifications
    DELETE FROM smp_vdm_notification_details
    WHERE  type=1
      AND  time_stamp < sdate
      AND  (name,target,execnum) NOT IN 
             (SELECT DISTINCT job_id, target_name, exec_num
	      FROM   smp_vdj_job_log)
    ;
 
    COMMIT;
 
    -- Now clean up all remainders for jobs which no longer contain info
    FOR r2 IN c2 LOOP
    BEGIN
      DELETE FROM smp_vdm_notification_details
        WHERE name = r2.job_id
          AND type = 1;
 
      DELETE FROM smp_vdj_job_log jl 
        WHERE job_id = r2.job_id;
 
      DELETE FROM smp_vdj_job 
        WHERE job_id = r2.job_id;
 
      DELETE FROM smp_vdi_pos 
        WHERE type = 'JOB' 
          AND id   = r2.job_id;
 
      DELETE FROM smp_vdi_target_properties 
        WHERE object_type = 'JOB'
          AND object_id   = r2.job_id;
 
      DELETE FROM smp_vdi_object_table 
        WHERE type        = 'JOB'
          AND object_name = r2.job_id;
 
      BEGIN
        SELECT object_id 
        INTO   vdu_id
        FROM   smp_vdu_objects_table
        WHERE  type        = 'JOB'
          AND  object_name = r2.job_id;
 
        DELETE FROM smp_vdu_privilege_table 
          WHERE object_oid = vdu_id;
 
        DELETE FROM smp_vdu_objects_table 
          WHERE object_id = vdu_id;
      EXCEPTION
        WHEN no_data_found THEN
             NULL;
        WHEN others THEN
             raise;
      END;
 
      COMMIT;
    END;
    END LOOP;
 
    COMMIT;
  END PurgeJobs;
 
  -- 
  -- FUNCTION: PurgeEvents
  --
  --   Archive all closed event notifications
  --     *  Only notifications, in the event history with status 15 are archived
  --     *  If the table SMP_VDE_ARCHIVED_EVENTS exist, and opt is set to 1, the 
  --        archived notification records will be stored in this table
  --     *  Cleanup the ISIS tables while cleaning up the events
  --
  PROCEDURE PurgeEvents (sdate IN DATE, opt IN NUMBER) IS
    archive_events NUMBER;
    vdu_id         NUMBER;
 
    open_time      DATE;
    close_time     DATE;
    time_warning   NUMBER;
    time_critical  NUMBER;
    time_error     NUMBER;
    time_down      NUMBER;
    time_unknown   NUMBER;
 
    isis_id        VARCHAR2(128);
 
    historyPresent EXCEPTION;
 
    CURSOR c1(sdate DATE) IS
      SELECT e.id, eo.event_occurrence_id, e.name, e.description, e.owner, eo.node_name, eo.target_name, eo.target_type, el.timestamp
      FROM   smp_vde_event e, smp_vde_event_target_info ti, smp_vde_event_occurrence eo,
             (SELECT event_occurrence_id, MAX(timestamp+timezone/86400000) timestamp FROM smp_vde_event_log GROUP BY event_occurrence_id) el
      WHERE  e.id = eo.event_id
        AND  eo.event_occurrence_id = el.event_occurrence_id
        AND  e.id = ti.event_id
        AND  eo.target_name = ti.target_name
        AND  eo.target_type = ti.target_type
        AND  (eo.severity = 15 OR ti.agent_status = 208)
        AND  eo.STATUS = 0
        AND  el.timestamp < sdate
    ;
 
    CURSOR c2(e_id NUMBER, occ_id NUMBER) IS
      SELECT   '/'||NVL(d.company,'oracle')||'/'||NVL(d.organization,'host')||'/'||NVL(d.product,'fault')||'/'||NVL(d.filename,'updown') event_test, l.timestamp+l.timezone/86400000 timestamp, l.severity, l.event_test_severity, l.author, l.ENTRY
      FROM     smp_vde_event_log l, smp_vde_event_details d
      WHERE    l.event_occurrence_id = occ_id
        AND    l.event_test_id = d.test_id (+)
        AND    e_id = d.event_id (+)
      ORDER BY timestamp DESC
      ;
 
    CURSOR c3 IS
      SELECT id 
      FROM   smp_vde_event e 
      WHERE  is_library='N'
        AND  NOT EXISTS (
                 SELECT event_id 
                 FROM   smp_vde_event_target_info
                 WHERE  event_id = e.id
                   AND  agent_status != 208)
        AND  NOT EXISTS (
                 SELECT event_id
                 FROM   smp_vde_event_occurrence
                 WHERE  event_id = e.id)
      ;
 
  BEGIN
    archive_events := 0;
 
    IF opt = 1 THEN
       SELECT COUNT(*)
       INTO   archive_events
       FROM   user_tables
       WHERE  table_name = 'SMP_VDE_ARCHIVED_EVENTS';
    END IF;
 
    FOR r1 IN c1(sdate) LOOP
    BEGIN
       IF archive_events = 1 THEN
          open_time     := r1.timestamp;
          close_time    := r1.timestamp;
          time_warning  := 0;
          time_critical := 0;
          time_error    := 0;
          time_down     := 0;
          time_unknown  := 0;
 
          FOR r2 IN c2(r1.id,r1.event_occurrence_id) LOOP
          BEGIN
              IF r2.severity <> -1 THEN
                 IF r2.severity = 18 THEN
                    time_error := time_error + (open_time-r2.timestamp);
                 ELSE
                    IF r2.severity = 20 THEN
                       time_warning := time_warning + (open_time-r2.timestamp);
                    ELSE
                       IF r2.severity = 25 THEN
                          time_critical := time_critical + (open_time-r2.timestamp);
                       ELSE
                         IF r2.severity = 303 THEN
                            time_down := time_down + (open_time-r2.timestamp);
                         ELSE
                            IF r2.severity <> 15 THEN
                               time_unknown := time_unknown + (open_time-r2.timestamp);
                            END IF;
                         END IF;
                       END IF;
                    END IF;
                 END IF;
                 open_time := r2.timestamp;
              END IF;
              INSERT INTO smp_vde_archived_event_logs (occurrence_id, event_test, timestamp, severity, test_severity, author, message)
                     VALUES (r1.event_occurrence_id, r2.event_test, r2.timestamp, r2.severity, r2.event_test_severity, r2.author, r2.entry);
          END;
          END LOOP;
 
          INSERT INTO smp_vde_archived_events (event_id, occurrence_id, event_name, event_desc, owner, node_name, target_name, target_type, open_time, close_time, time_warning, time_critical, time_down, time_error, time_unknown)
                 VALUES (r1.id, r1.event_occurrence_id, r1.name, r1.description, r1.owner, r1.node_name, r1.target_name, r1.target_type, open_time, close_time, time_warning, time_critical, time_down, time_error, time_unknown);
       END IF;
 
       DELETE FROM smp_vde_event_occurrence
         WHERE event_occurrence_id = r1.event_occurrence_id;
 
       DELETE FROM smp_vdm_notification_details
         WHERE name    = r1.id
           AND execnum = r1.event_occurrence_id
           AND type    = 2;
 
       COMMIT;
    END;
    END LOOP;
 
    -- Remove ghost events
    FOR r3 IN c3 LOOP
    BEGIN
       DELETE FROM smp_vdm_notification_details
         WHERE name = r3.id
           AND type = 2;
 
       DELETE FROM smp_vde_event 
         WHERE id = r3.id;
 
       DELETE FROM smp_vdi_pos 
         WHERE type = 'EVENT'
           AND id   = r3.id;
 
       DELETE FROM smp_vdi_target_properties
         WHERE object_type = 'EVENT'
           AND object_id   = r3.id;
 
       DELETE FROM smp_vdi_object_table
         WHERE type        = 'EVENT'
           AND object_name = TO_CHAR(r3.id);
 
       BEGIN
          SELECT object_id 
          INTO   vdu_id
          FROM   smp_vdu_objects_table
          WHERE  object_name = TO_CHAR(r3.id)
            AND  type        = 'EVENT';
 
          DELETE FROM smp_vdu_privilege_table
             WHERE object_oid = vdu_id;
 
          DELETE FROM smp_vdu_objects_table
             WHERE object_id = vdu_id;
       EXCEPTION
          WHEN no_data_found THEN
               NULL;
       END;
 
       COMMIT;
    EXCEPTION
       WHEN historyPresent THEN
            vdu_id := 0;
       WHEN others THEN
            RAISE;
    END;
    END LOOP;
 
    COMMIT;
  END PurgeEvents;
 
  -- 
  -- FUNCTION: PurgeSLR
  --
  --   Cleans up the SLR data in SMP_VDE_EVENT_ARCHIVE table, based on the
  --   keep_date value in SMP_VDE_EVENT_ARCHIVE_PURGE
  --
  PROCEDURE PurgeSLR IS
    purge_date DATE;
  BEGIN
    BEGIN
      SELECT SYSDATE-keep_days
      INTO   purge_date
      FROM   smp_vde_event_archive_purge
      WHERE  ROWNUM=1;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
         purge_date := SYSDATE-365;
    END;
 
    DELETE FROM smp_vde_event_archive
      WHERE occur_date < purge_date;
    COMMIT;
  END PurgeSLR;
 
  -- 
  -- FUNCTION: PurgeOperations
  --
  --   Cleans up orphans in the SMP_VDD_OPERATIONS_TABLE
  --
  PROCEDURE PurgeOperations IS
  BEGIN
    -- First step: Remove operations for nodes which no longer exist
    DELETE FROM smp_vdd_operations_table
    WHERE  request_id != -1
      AND  owner = 'OP_UNALLOCATED'
      AND  node NOT IN (SELECT name FROM smp_vdn_node_list);
    COMMIT;
 
    -- Next: Remove operations for targets which no longer exist
    DELETE FROM smp_vdd_operations_table
    WHERE  request_id != -1
      AND  owner = 'OP_UNALLOCATED'
      AND  target LIKE '%|%'
      AND  target NOT IN (SELECT tl.name || '|' || ttd.name
                          FROM   smp_vdn_target_list tl, smp_vdn_target_type_defn ttd
                          WHERE  tl.typeid = ttd.id);
    COMMIT;
  END PurgeOperations;
 
  -- 
  -- FUNCTION: PurgeExpertTables
  --
  --   Cleans up orphans Expert/SQL Analyze/Index Tuning Wizard tables for
  --   databases which no longer exist in the repository
  --
  PROCEDURE PurgeExpertTables IS
    CURSOR c1 IS
      SELECT v1.db_id database_id
      FROM   (SELECT vdk_parent_id db_id
              FROM  (SELECT vdk_parent_id
                     FROM  vdk_object
                     WHERE  vdk_type=10 OR vdk_type = 102) 
              GROUP BY vdk_parent_id) v1,
             (SELECT vdk_id db_id2, vdk_name db_name
              FROM   vdk_object
              WHERE  vdk_type = 171) v2
      WHERE  v1.db_id = v2.db_id2
        AND  v2.db_name NOT IN 
               (SELECT tl.name
                FROM   smp_vdn_target_list tl, smp_vdn_target_type_defn ttd
                WHERE  ttd.name = 'oracle_sysman_database'
                  AND  ttd.id   = tl.typeid)   
    ;
  BEGIN
    FOR r1 IN c1 LOOP
    BEGIN
      PurgeExpertSession(r1.database_id);
    END;
    END LOOP;
  END PurgeExpertTables;
 
  -- 
  -- FUNCTION: PurgeExpertSession
  --
  --   Cleans up Expert/SQL Analyze/Index Tuning Wizard tables for
  --   a given expert session
  --
  PROCEDURE PurgeExpertSession(databaseID IN NUMBER) IS
    TYPE cursorType IS REF CURSOR;
    aCursor cursorType;
    stmt VARCHAR(1000);
    session_id    NUMBER;
    object_type  NUMBER;
  BEGIN
    stmt := 'SELECT vdk_id, vdk_type FROM vdk_object WHERE vdk_parent_id = :1 AND (vdk_type=10 OR vdk_type=102)';
    OPEN aCursor FOR stmt USING databaseID;
    LOOP
      FETCH aCursor INTO session_id, object_type;
      EXIT WHEN aCursor%NOTFOUND;
      DELETE FROM vdk_session WHERE vdk_id = session_id;
      DELETE FROM vdk_object  WHERE vdk_id = session_id;
      INSERT INTO vdk_delete_queue (vdk_id,vdk_type,vdk_date)
        VALUES (session_id,object_type,SYSDATE);
      COMMIT;
    END LOOP;
    CLOSE aCursor;
  END PurgeExpertSession;
 
  -- 
  -- FUNCTION: CheckPendingDeleteEvents
  --
  --   If there are events in pending delete, checks to see if there is an 
  --   operation for this removal.
  --   If the operation is not there, add it to the operations table
  --
  --   It is the responsibility of the caller, to COMMIT the transaction.
  --
  PROCEDURE CheckPendingDeleteEvents IS
    req_subt  VARCHAR(1);
    req_type  VARCHAR(5);
    owner     VARCHAR(15);
    callback  VARCHAR(3);
    timestamp NUMBER;
    outgoing  VARCHAR(1);
 
    CURSOR c1 IS
      SELECT i.event_id, i.target_name, i.target_type, i.node_name, e.owner
      FROM   smp_vde_event_target_info i, smp_vde_event e
      WHERE  i.agent_status = 207
        AND  i.event_id = e.id
        AND  NOT EXISTS (
               SELECT 'x'
               FROM   smp_vdd_operations_table
               WHERE  request_id      = i.event_id
                 AND  request_subtype = '2'
                 AND  request_type    = 'EVENT'
             )
    ;
 
  BEGIN
    req_subt  := '2';
    req_type  := 'EVENT';
    owner     := 'OP_UNALLOCATED';
    callback  := 'vde';
    timestamp := 0;
    outgoing  := 'Y';
    FOR r1 IN c1 LOOP
    BEGIN
       INSERT INTO smp_vdd_operations_table (request_id,request_subtype,request_type,target,node,user_name,owner,callback,timestamp,outgoing,sequence_num)
         VALUES (r1.event_id,req_subt,req_type,r1.target_name||'|'||r1.target_type,r1.node_name,r1.owner,owner,callback,timestamp,outgoing,smp_vdd_op_seq.NEXTVAL);
    END;
    END LOOP;
  END CheckPendingDeleteEvents;
 
  -- 
  -- FUNCTION: CheckPendingDeleteHosts
  --
  --   If there are hosts in pending delete, checks to see if there is an 
  --   operation for this removal.
  --   If the operation is not there, add it to the operations table
  --
  --   It is the responsibility of the caller, to COMMIT the transaction.
  --
  PROCEDURE CheckPendingDeleteHosts IS
    req_id    NUMBER;
    req_subt  VARCHAR(1);
    req_type  VARCHAR(5);
    owner     VARCHAR(15);
    callback  VARCHAR(3);
    timestamp NUMBER;
    outgoing  VARCHAR(1);
 
    CURSOR c1 IS
      SELECT n.name
      FROM   smp_vdn_node_list n
      WHERE  n.STATUS = 'D'
        AND  NOT EXISTS (
               SELECT 'x'
               FROM   smp_vdd_operations_table o
               WHERE  o.request_id      = 0
                 AND  o.request_subtype = '1'
                 AND  o.request_type    = 'GROUP'
                 AND  o.node            = n.name
             )
    ;
 
  BEGIN
    req_id    := 0;
    req_subt  := '1';
    req_type  := 'GROUP';
    owner     := 'OP_UNALLOCATED';
    callback  := 'vdn';
    timestamp := 0;
    outgoing  := 'N';
    FOR r1 IN c1 LOOP
    BEGIN
       INSERT INTO smp_vdd_operations_table (request_id,request_subtype,request_type,target,node,user_name,owner,callback,timestamp,outgoing,sequence_num)
         VALUES (req_id,req_subt,req_type,r1.name||'|oracle_sysman_node',r1.name,'sysman',owner,callback,timestamp,outgoing,smp_vdd_op_seq.NEXTVAL);
    END;
    END LOOP;
  END CheckPendingDeleteHosts;
 
  -- 
  -- FUNCTION: CheckPendingDeletejobs
  --
  --   If there are jobs in pending delete, checks to see if there is an 
  --   operation for this removal.
  --   If the operation is not there, add it to the operations table
  --
  --   It is the responsibility of the caller, to COMMIT the transaction.
  --
  PROCEDURE CheckPendingDeleteJobs IS
    req_subt  VARCHAR2(15);
    req_type  VARCHAR(5);
    owner     VARCHAR(15);
    callback  VARCHAR(3);
    timestamp NUMBER;
    outgoing  VARCHAR(1);
 
    CURSOR c1 IS
      SELECT j.job_id, jpt.target_name, jpt.target_type, jpt.node_name, j.owner
      FROM   SMP_VDJ_JOB_PER_TARGET jpt, SMP_VDJ_JOB j
      WHERE  j.job_id = jpt.job_id
        AND  jpt.STATUS = 13
        AND  NOT EXISTS (
             SELECT 'x'
             FROM   smp_vdd_operations_table
             WHERE  request_id      = j.job_id
               AND  request_subtype = 'DeleteJob'
               AND  request_type    = 'JOB'
             )
    ;
 
  BEGIN
    req_subt  := 'DeleteJob';
    req_type  := 'JOB';
    owner     := 'OP_UNALLOCATED';
    callback  := 'vdj';
    timestamp := 0;
    outgoing  := 'Y';
    FOR r1 IN c1 LOOP
    BEGIN
       INSERT INTO smp_vdd_operations_table (request_id,request_subtype,request_type,target,node,user_name,owner,callback,timestamp,outgoing,sequence_num)
         VALUES (r1.job_id,req_subt,req_type,r1.target_name||'|'||r1.target_type,r1.node_name,r1.owner,owner,callback,timestamp,outgoing,smp_vdd_op_seq.NEXTVAL);
    END;
    END LOOP;
  END CheckPendingDeleteJobs;
 
  --
  -- FUNCTION: CheckNodeUpdown
  --
  --   Fixes a problem between the Event Up/Down queue, and the Ping Up/Down
  --   queue
  --
  --   It is the responsibility of the caller, to COMMIT the transaction.
  --
  PROCEDURE CheckNodeUpdown IS
    x         NUMBER;
    dummy     VARCHAR2(10);
    req_subt  VARCHAR(2);
    req_type  VARCHAR(5);
    owner     VARCHAR(15);
    callback  VARCHAR(3);
    timestamp DATE;
    outgoing  VARCHAR(1);
 
    CURSOR c1 IS
      SELECT s.event_id, s.target_name, s.target_type, s.node_name, e.owner, p.down_timezone
      FROM   smp_vde_event_target_state s, smp_vde_event_target_info i, smp_vde_event e, smp_vdp_node_info p
      WHERE  s.node_state = 303
        AND  s.target_type = 'oracle_sysman_node'
        AND  s.event_id = i.event_id
        AND  s.target_name = i.target_name
        AND  s.target_type = i.target_type
        AND  i.agent_status = 205
        AND  s.node_name = p.node
        AND  p.STATUS = 'Y'
        AND  s.event_id = e.id
      ;
 
  BEGIN
    x         := 0;
    dummy     := 'DONT CARE';
    req_subt  := '10';
    req_type  := 'EVENT';
    owner     := 'OP_UNALLOCATED';
    callback  := 'vde';
    timestamp := NEW_TIME(SYSDATE,'HDT','GMT');
    outgoing  := 'N';
    FOR r1 IN c1 LOOP
    BEGIN
       -- Insert the operation
       INSERT INTO smp_vdd_operations_table (request_id,request_subtype,request_type,target,node,user_name,owner,callback,timestamp,outgoing,sequence_num)
          VALUES (x,req_subt,req_type,dummy,r1.node_name,dummy,owner,callback,x,outgoing,smp_vdd_op_seq.NEXTVAL);
 
       -- Cleanup the Up/Down node queue
       DELETE FROM smp_vde_node_updown_queue
          WHERE node = r1.node_name;
 
       INSERT INTO smp_vde_node_updown_queue(sequence_num,node,updown,timestamp,timezone)
          VALUES (smp_vde_node_updown_seq.NEXTVAL,r1.node_name,'Y',timestamp,r1.down_timezone);
 
       -- Cleanup the Up/Down event queue
       DELETE FROM smp_vde_event_updown_queue
          WHERE (target_name,target_type) IN
                   (SELECT tl.name, ttd.name
                    FROM   smp_vdn_target_list tl, smp_vdn_target_type_defn ttd, smp_vdn_node_list nl
                    WHERE  nl.name = r1.node_name
                      AND  nl.id = tl.nodeid
                      AND  tl.typeid = ttd.id);
    END;
    END LOOP;
  END CheckNodeUpdown;
 
  --
  -- FUNCTION: PurgeHostname
  --
  --   Remove all records from a decommissioned machine from the repository.
  --
  PROCEDURE PurgeHostname(old_name IN VARCHAR2) IS
    dummy    NUMBER;
  BEGIN
    -- Sanity check:
    -- 1) Make sure old_name is no longer valid
    SELECT COUNT(*)
    INTO   dummy
    FROM   smp_vdn_node_list
    WHERE  name = old_name;
 
    IF dummy <> 0 THEN
       raise_application_error(-20000,'Old node '||old_name||' still exists in repository (VDN)');
    END IF;
 
    SELECT COUNT(*)
    INTO   dummy
    FROM   smp_vdg_node_list
    WHERE  nodename = old_name;
 
    IF dummy <> 0 THEN
       raise_application_error(-20000,'Old node '||old_name||' still exists in repository (VDG)');
    END IF;
 
    SELECT COUNT(*)
    INTO   dummy
    FROM   smp_vdp_nodes
    WHERE  node = old_name;
 
    IF dummy <> 0 THEN
       raise_application_error(-20000,'Old node '||old_name||' still exists in repository (VDP)');
    END IF;
 
    -- Phase 0
    -- Skipping all VDN, VDP and VDG tables, since the previous check 
    -- should make those checks pointless...
    -- 1 exception: SMP_VDN_STATE
    DELETE 
      FROM  smp_vdn_state
      WHERE node = old_name
    ;
    dbms_output.put_line('smp_vdn_state                 : '||SQL%ROWCOUNT);
 
    -- Phase 1
    -- Remove all pending operations
    DELETE 
      FROM  smp_vdd_operations_table
      WHERE node = old_name
    ;
    dbms_output.put_line('smp_vdd_operations_table      : '||SQL%ROWCOUNT);
 
    -- Phase 2
    -- Remove all event info about this node
    DELETE 
      FROM  smp_vde_event_occurrence
      WHERE node_name = old_name
    ;
    dbms_output.put_line('smp_vde_event_occurrence      : '||SQL%ROWCOUNT);
    DELETE 
      FROM  smp_vde_event_target_ack
      WHERE node_name = old_name
    ;
    dbms_output.put_line('smp_vde_event_target_ack      : '||SQL%ROWCOUNT);
    DELETE
      FROM  smp_vde_event_target_details
      WHERE node_name = old_name
    ;
    dbms_output.put_line('smp_vde_event_target_details  : '||SQL%ROWCOUNT);
    DELETE
      FROM  smp_vde_event_target_info
      WHERE node_name = old_name
    ;
    dbms_output.put_line('smp_vde_event_target_info     : '||SQL%ROWCOUNT);
    DELETE
      FROM  smp_vde_event_target_state
      WHERE node_name = old_name
    ;
    dbms_output.put_line('smp_vde_event_target_state    : '||SQL%ROWCOUNT);
    DELETE 
      FROM  smp_vde_node_updown_queue
      WHERE node = old_name
    ;
    dbms_output.put_line('smp_vde_node_updown_queue     : '||SQL%ROWCOUNT);
 
    -- Phase 3
    -- Removed all job info about this node
    DELETE 
      FROM  smp_vdj_job_per_target
      WHERE node_name = old_name
    ;
    dbms_output.put_line('smp_vdj_job_per_target        : '||SQL%ROWCOUNT);
 
    -- Phase 4
    -- Removed all notification info about this node
    DELETE 
      FROM  smp_vdm_notification
      WHERE node_name = old_name
    ;
    dbms_output.put_line('smp_vdm_notification          : '||SQL%ROWCOUNT);
    DELETE 
      FROM  smp_vdm_notification_services
      WHERE nodename = old_name
    ;
    dbms_output.put_line('smp_vdm_notification_services : '||SQL%ROWCOUNT);
 
  END PurgeHostname;
 
  -- 
  -- FUNCTION: FixHostnameChange
  --
  --   After a refresh of a node with a new canonical name, the VDG and VDP
  --   tables are updated, but registered job and events are not updated.
  --   This routine changes the hostname of these jobs and events from the 
  --   old to the new name.
  --
  PROCEDURE FixHostnameChange(old_name IN VARCHAR2, new_name IN VARCHAR2) IS
    dummy    NUMBER;
  BEGIN
    -- Sanity check:
    -- 1) Make sure old_name is no longer valid
    -- 2) Make sure new_name is a valid node
    SELECT COUNT(*)
    INTO   dummy
    FROM   smp_vdn_node_list
    WHERE  name = old_name;
 
    IF dummy <> 0 THEN
       raise_application_error(-20000,'Old node '||old_name||' still exists in repository');
    END IF;
 
    SELECT COUNT(*)
    INTO   dummy
    FROM   smp_vdn_node_list
    WHERE  name = new_name;
 
    IF dummy < 1 THEN
       raise_application_error(-20000,'New node '||new_name||' does not exist in repository');
    ELSE 
       IF dummy > 1 THEN
          raise_application_error(-20000,'**CORRUPTION** : New node '||new_name||' registered '||dummy||' times in repository.');
       END IF;
    END IF;
 
    -- Phase 1a
    -- Update all currently registered events
    UPDATE smp_vde_event_target_info
      SET   node_name = new_name
      WHERE node_name = old_name
        AND agent_status IN (204,205,206,207,210,211,212)
    ;
    UPDATE smp_vde_event_target_state
      SET   node_name = new_name
      WHERE node_name = old_name
    ;
 
    -- Phase 2
    -- Update all currently registered jobs
    UPDATE smp_vdj_job_per_target
      SET node_name = new_name
      WHERE (job_id,target_name,exec_num) IN
            (SELECT job_id, target_name, exec_num
             FROM   smp_vdj_job_per_target
             WHERE  exec_num > 0
               AND  node_name = old_name
             GROUP BY job_id, target_name, target_type, exec_num HAVING MAX(STATUS) < 9)
    ;
 
    -- Phase 3
    -- Update all currently pending operations
    UPDATE smp_vdd_operations_table
      SET   node  = new_name
      WHERE node  = old_name
        AND owner = 'OP_UNALLOCATED'
    ;
 
  END FixHostnameChange;
 
  -- 
  -- FUNCTION: Statistics
  --
  --   Uploads daily statistics about the major components of the EM system
  --
  PROCEDURE Statistics IS
    tstamp         DATE;
    n_admins       NUMBER;
    n_super        NUMBER;
    n_oms          NUMBER;
    n_nodes        NUMBER;
    n_targets      NUMBER;
    n_groups       NUMBER;
    n_jobs         NUMBER;
    n_events       NUMBER;
    n_vdm_notifs   NUMBER;
    n_job_notifs   NUMBER;
    n_evt_notifs   NUMBER;
  BEGIN
    tstamp := TRUNC(sysdate-1);
 
    SELECT COUNT(*), SUM(superuser) 
    INTO   n_admins, n_super
    FROM   smp_view_administrators;
 
    SELECT COUNT(mas_name)
    INTO   n_oms
    FROM   smp_vdf_maslist;
 
    SELECT COUNT(id)
    INTO   n_nodes
    FROM   smp_vdn_node_list;
 
    SELECT COUNT(id)
    INTO   n_targets
    FROM   smp_vdn_target_list;
 
    SELECT COUNT(id)
    INTO   n_groups
    FROM   smp_vdn_group_list;
 
    SELECT COUNT(targetname)
    INTO   n_jobs
    FROM   smp_vdg_jobid_map;
 
    SELECT COUNT(masid)
    INTO   n_events
    FROM   smp_vdg_eventid_map;
 
    SELECT COUNT(*)
    INTO   n_vdm_notifs
    FROM   smp_vdm_notification_details
    WHERE  TRUNC(time_stamp) = tstamp;
 
    SELECT COUNT(*)
    INTO   n_job_notifs
    FROM   smp_vdj_job_log
    WHERE  TRUNC(time_stamp) = tstamp;
 
    SELECT COUNT(*)
    INTO   n_evt_notifs
    FROM   smp_vde_event_log
    WHERE  TRUNC(timestamp) = tstamp;
 
    INSERT INTO smp_vdt_statistics (day,administrators,superusers,oms,nodes,targets,groups,jobs,events,vdm_notifs,job_notifs,evt_notifs)
       VALUES(tstamp,n_admins,n_super,n_oms,n_nodes,n_targets,n_groups,n_jobs,n_events,n_vdm_notifs,n_job_notifs,n_evt_notifs);
    COMMIT;
  END Statistics;
 
  -- 
  -- FUNCTION: ShowOrphanHosts
  --
  --   List count of all target orphans in tables
  --
  PROCEDURE ShowOrphanHosts IS
 
     PROCEDURE FindOrphanHosts( cname IN VARCHAR2 ) IS
       cnt   PLS_INTEGER;
       stmt  VARCHAR2(2000);
 
       CURSOR c2 IS
         SELECT table_name
         FROM   user_tab_columns
         WHERE  column_name = cname
           AND  table_name != 'SMP_VDG_NODE_LIST'
           AND  table_name != 'SMP_VDP_NODES'
           AND  table_name != 'SMP_VDN_NODE_LIST'
           AND  table_name != 'SMP_VDE_ARCHIVED_EVENTS'
           AND  table_name != 'SMP_VDJ_ARCHIVED_JOBS'
           AND  table_name != 'SMP_VDN_STATE'
           AND  table_name NOT IN (SELECT view_name FROM user_views)
       ;
     BEGIN
       dbms_output.put_line('** = '||cname||' = **');
       FOR r2 IN c2 LOOP
           stmt := 'SELECT COUNT(*) FROM '||r2.table_name||' WHERE '||cname||' NOT IN (SELECT node FROM smp_vdp_nodes)';
           EXECUTE IMMEDIATE stmt INTO cnt;
           IF cnt > 0 THEN
              dbms_output.put_line(RPAD(r2.table_name,32,' ')||' : '||LPAD(TO_CHAR(cnt),6,' '));
           END IF;
       END LOOP;
     END;
 
  BEGIN
    FindOrphanHosts('NODE');
    FindOrphanHosts('NODENAME');
    FindOrphanHosts('NODE_NAME');
  END ShowOrphanHosts;
 
  -- 
  -- FUNCTION: ResetSYSMAN
  --
  --   Resets the password of SYSMAN
  --
  -- PROCEDURE ResetSYSMAN IS
  -- BEGIN
  --  UPDATE smp_vdu_principals_table
  --    SET   password = '9ed0fa64a76b4bd912310580f74926ca'
  --    WHERE principal_name = UPPER('SYSMAN');
  --  COMMIT;
  -- END;
 
END dbms_oem;
/
bouyao est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/08/2005, 08h15   #14
Rédacteur/Modérateur
 
Avatar de fadace
 
Homme Fabien Celaia
Administrateur de base de données
Inscription : octobre 2002
Messages : 3 779
Détails du profil
Informations personnelles :
Nom : Homme Fabien Celaia
Âge : 41
Localisation : Suisse

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : octobre 2002
Messages : 3 779
Points : 8 124
Points : 8 124
Envoyer un message via ICQ à fadace Envoyer un message via Skype™ à fadace
En fait, toutes mes tâches fonctionnent correctement : c'est juste au niveau de l'OEM qu'il semble y avoir le problème du gel des tâches attachée à cette instance
- jobs supprimés restant définitivement en attente de suppression
- jobs ajoutés restant en status "Soumis" sans pour autant passer un "programmé"
- jobs quotidiens programmés ayant une date gelée au 31 juillet (au lieu de s'incrémenter de jour en jour)
__________________
Sr DBA Oracle / Sybase / MS-SQL / DB2 / Informix / Postgresql
Administrateur SAP
Mes articles

Attention : pas de réponse technique par MP : pensez aux autres, passez par les forums !
fadace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/08/2005, 08h43   #15
Rédacteur/Modérateur
 
Avatar de fadace
 
Homme Fabien Celaia
Administrateur de base de données
Inscription : octobre 2002
Messages : 3 779
Détails du profil
Informations personnelles :
Nom : Homme Fabien Celaia
Âge : 41
Localisation : Suisse

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : octobre 2002
Messages : 3 779
Points : 8 124
Points : 8 124
Envoyer un message via ICQ à fadace Envoyer un message via Skype™ à fadace
et toujours pas ces tables smp... d'où viennent-elles ?
__________________
Sr DBA Oracle / Sybase / MS-SQL / DB2 / Informix / Postgresql
Administrateur SAP
Mes articles

Attention : pas de réponse technique par MP : pensez aux autres, passez par les forums !
fadace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/08/2005, 17h56   #16
Rédacteur/Modérateur
 
Avatar de fadace
 
Homme Fabien Celaia
Administrateur de base de données
Inscription : octobre 2002
Messages : 3 779
Détails du profil
Informations personnelles :
Nom : Homme Fabien Celaia
Âge : 41
Localisation : Suisse

Informations professionnelles :
Activité : Administrateur de base de données
Secteur : Service public

Informations forums :
Inscription : octobre 2002
Messages : 3 779
Points : 8 124
Points : 8 124
Envoyer un message via ICQ à fadace Envoyer un message via Skype™ à fadace
J'ai résolu tout ça en bougeant un paramètre du sqlnet.ora, en redémarrant l'agent et l'oms et en régénérant le noeud posant problème. Merci quand même
__________________
Sr DBA Oracle / Sybase / MS-SQL / DB2 / Informix / Postgresql
Administrateur SAP
Mes articles

Attention : pas de réponse technique par MP : pensez aux autres, passez par les forums !
fadace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/07/2007, 11h01   #17
Invité de passage
 
Inscription : juillet 2007
Messages : 3
Détails du profil
Informations forums :
Inscription : juillet 2007
Messages : 3
Points : 2
Points : 2
Je suis ennuyé par ce même problème. Quelle en est la source et comment le résoudre ?
Merci.
poubourna est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 14h42.


 
 
 
 
Partenaires

Hébergement Web