1: package body rmjvm is
2:
3: procedure exec (x varchar2) as
4: begin
5: initjvmaux.exec(x);
38:
39: declare
40: c number;
41: begin
42: select count(*) into c from java$rmjvm$aux;
43: if c = 0 then
44: commit;
45: initjvmaux.rollbackset;
46: if remove_all then
43: if c = 0 then
44: commit;
45: initjvmaux.rollbackset;
46: if remove_all then
47: exec('insert into java$rmjvm$aux (select obj# from obj$ where ' ||
48: 'type#=28 or type#=29 or type#=30 or namespace=32)');
49: else
50: exec('insert into java$rmjvm$aux (select joxftobn from x$joxfc ' ||
51: 'where bitand(joxftflags,96)!=0)');
46: if remove_all then
47: exec('insert into java$rmjvm$aux (select obj# from obj$ where ' ||
48: 'type#=28 or type#=29 or type#=30 or namespace=32)');
49: else
50: exec('insert into java$rmjvm$aux (select joxftobn from x$joxfc ' ||
51: 'where bitand(joxftflags,96)!=0)');
52: commit;
53: initjvmaux.rollbackset;
54: exec('insert into java$rmjvm$aux (select joxftobn from x$joxfr ' ||
50: exec('insert into java$rmjvm$aux (select joxftobn from x$joxfc ' ||
51: 'where bitand(joxftflags,96)!=0)');
52: commit;
53: initjvmaux.rollbackset;
54: exec('insert into java$rmjvm$aux (select joxftobn from x$joxfr ' ||
55: 'where bitand(joxftflags,96)!=0)');
56: commit;
57: initjvmaux.rollbackset;
58: exec('insert into java$rmjvm$aux (select obj# from obj$ ' ||
54: exec('insert into java$rmjvm$aux (select joxftobn from x$joxfr ' ||
55: 'where bitand(joxftflags,96)!=0)');
56: commit;
57: initjvmaux.rollbackset;
58: exec('insert into java$rmjvm$aux (select obj# from obj$ ' ||
59: 'where namespace=32)');
60: end if;
61: end if;
62: end;
84:
85: dbms_output.put_line('drop synonyms with java targets');
86:
87: DECLARE
88: cursor C1 is select name from java$rmjvm$aux2;
89:
90: DDL_CURSOR integer;
91: syn_name varchar2(30);
92: iterations number;
101: DDL_CURSOR := dbms_sql.open_cursor;
102:
103: loop
104:
105: exec('delete from java$rmjvm$aux2');
106: if remove_all then
107: exec('insert into java$rmjvm$aux2 (select unique o1.name from ' ||
108: 'obj$ o1,obj$ o2 where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.type#=29)');
109: else
103: loop
104:
105: exec('delete from java$rmjvm$aux2');
106: if remove_all then
107: exec('insert into java$rmjvm$aux2 (select unique o1.name from ' ||
108: 'obj$ o1,obj$ o2 where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.type#=29)');
109: else
110: exec('insert into java$rmjvm$aux2 (select unique o1.name ' ||
111: 'from obj$ o1,obj$ o2, java$rmjvm$aux j ' ||
106: if remove_all then
107: exec('insert into java$rmjvm$aux2 (select unique o1.name from ' ||
108: 'obj$ o1,obj$ o2 where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.type#=29)');
109: else
110: exec('insert into java$rmjvm$aux2 (select unique o1.name ' ||
111: 'from obj$ o1,obj$ o2, java$rmjvm$aux j ' ||
112: 'where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.obj#=j.obj#)');
113: end if;
114:
107: exec('insert into java$rmjvm$aux2 (select unique o1.name from ' ||
108: 'obj$ o1,obj$ o2 where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.type#=29)');
109: else
110: exec('insert into java$rmjvm$aux2 (select unique o1.name ' ||
111: 'from obj$ o1,obj$ o2, java$rmjvm$aux j ' ||
112: 'where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.obj#=j.obj#)');
113: end if;
114:
115: -- To make sure we eventually stop, pick a max number of iterations
112: 'where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.obj#=j.obj#)');
113: end if;
114:
115: -- To make sure we eventually stop, pick a max number of iterations
116: select count(*) into iterations from java$rmjvm$aux2;
117:
118: exit when iterations=0 or iterations >= previous_iterations;
119: previous_iterations := iterations;
120: loop_count := 0;
177: dbms_output.put_line('delete from dependency$');
178:
179: if remove_all then
180: select count(*) into total_to_delete from dependency$
181: where p_obj# in (select obj# from java$rmjvm$aux);
182: else
183: select count(*) into total_to_delete from dependency$
184: where p_obj# in (select obj# from obj$ where (type#=29 or type#=56));
185: end if;
189: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
190: initjvmaux.rollbackset;
191: if remove_all then
192: delete from dependency$ where p_obj# in
193: (select obj# from java$rmjvm$aux)
194: and rownum <= deletions_per_iteration;
195: else
196: delete from dependency$ where p_obj# in
197: (select obj# from obj$ where (type#=29 or type#=56))
207: dbms_output.put_line('delete from error$');
208:
209: if remove_all then
210: select count(*) into total_to_delete from error$
211: where obj# in (select obj# from java$rmjvm$aux);
212: else
213: select count(*) into total_to_delete from error$
214: where obj# in (select obj# from obj$
215: where type#=28 or type#=29 or type#=30 or type#=56);
219: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
220: initjvmaux.rollbackset;
221: if remove_all then
222: delete from error$ where obj# in
223: (select obj# from java$rmjvm$aux)
224: and rownum <= deletions_per_iteration;
225: else
226: delete from error$ where obj# in
227: (select obj# from obj$ where type#=28 or type#=29 or type#=30 or type#=56)
236:
237: dbms_output.put_line('delete from objauth$');
238:
239: select count(*) into total_to_delete from objauth$
240: where obj# in (select obj# from java$rmjvm$aux);
241: commit;
242: loop
243: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
244: initjvmaux.rollbackset;
241: commit;
242: loop
243: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
244: initjvmaux.rollbackset;
245: delete from objauth$ where obj# in (select obj# from java$rmjvm$aux)
246: and rownum <= deletions_per_iteration;
247: commit;
248: exit when total_to_delete <= deletions_per_iteration;
249: total_to_delete := total_to_delete - deletions_per_iteration;
253:
254: dbms_output.put_line('delete from javaobj$');
255:
256: select count(*) into total_to_delete from javaobj$
257: where obj# in (select obj# from java$rmjvm$aux);
258: commit;
259: loop
260: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
261: initjvmaux.rollbackset;
258: commit;
259: loop
260: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
261: initjvmaux.rollbackset;
262: delete from javaobj$ where obj# in (select obj# from java$rmjvm$aux)
263: and rownum <= deletions_per_iteration;
264: commit;
265: exit when total_to_delete <= deletions_per_iteration;
266: total_to_delete := total_to_delete - deletions_per_iteration;
270:
271: dbms_output.put_line('delete from access$');
272:
273: select count(*) into total_to_delete from access$
274: where d_obj# in (select obj# from java$rmjvm$aux);
275: commit;
276: loop
277: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
278: initjvmaux.rollbackset;
275: commit;
276: loop
277: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
278: initjvmaux.rollbackset;
279: delete from access$ where d_obj# in (select obj# from java$rmjvm$aux)
280: and rownum <= deletions_per_iteration;
281: commit;
282: exit when total_to_delete <= deletions_per_iteration;
283: total_to_delete := total_to_delete - deletions_per_iteration;
295:
296: dbms_output.put_line('delete from idl_ub1$');
297:
298: select count(*) into total_to_delete
299: from idl_ub1$ where obj# in (select obj# from java$rmjvm$aux);
300: commit;
301: loop
302: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
303: initjvmaux.rollbackset;
300: commit;
301: loop
302: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
303: initjvmaux.rollbackset;
304: delete from idl_ub1$ where obj# in (select obj# from java$rmjvm$aux)
305: and rownum <= deletions_per_iteration;
306: commit;
307: exit when total_to_delete <= deletions_per_iteration;
308: total_to_delete := total_to_delete - deletions_per_iteration;
311: dbms_output.put_line('delete from idl_ub2$');
312:
313: execute immediate
314: 'select count(*) from idl_ub2$ ' ||
315: 'where obj# in (select obj# from java$rmjvm$aux)' into total_to_delete;
316: commit;
317: loop
318: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
319: initjvmaux.rollbackset;
317: loop
318: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
319: initjvmaux.rollbackset;
320: execute immediate
321: 'delete from idl_ub2$ where obj# in (select obj# from java$rmjvm$aux) ' ||
322: 'and rownum <= :deletions_per_iteration' using deletions_per_iteration;
323: commit;
324: exit when total_to_delete <= deletions_per_iteration;
325: total_to_delete := total_to_delete - deletions_per_iteration;
327:
328: dbms_output.put_line('delete from idl_char$');
329:
330: select count(*) into total_to_delete
331: from idl_char$ where obj# in (select obj# from java$rmjvm$aux);
332: commit;
333: loop
334: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
335: initjvmaux.rollbackset;
332: commit;
333: loop
334: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
335: initjvmaux.rollbackset;
336: delete from idl_char$ where obj# in (select obj# from java$rmjvm$aux)
337: and rownum <= deletions_per_iteration;
338: commit;
339: exit when total_to_delete <= deletions_per_iteration;
340: total_to_delete := total_to_delete - deletions_per_iteration;
343: dbms_output.put_line('delete from idl_sb4$');
344:
345: execute immediate
346: 'select count(*) from idl_sb4$ ' ||
347: 'where obj# in (select obj# from java$rmjvm$aux)' into total_to_delete;
348: commit;
349: loop
350: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
351: initjvmaux.rollbackset;
349: loop
350: dbms_output.put_line(total_to_delete ||' remaining at ' || to_char(sysdate,'mm-dd hh:mi:ss'));
351: initjvmaux.rollbackset;
352: execute immediate
353: 'delete from idl_sb4$ where obj# in (select obj# from java$rmjvm$aux) ' ||
354: 'and rownum <= :deletions_per_iteration' using deletions_per_iteration;
355: commit;
356: exit when total_to_delete <= deletions_per_iteration;
357: total_to_delete := total_to_delete - deletions_per_iteration;
377: (select o1.obj# from obj$ o1,obj$ o2
378: where o1.name=o2.name and
379: o1.type#=5 and o1.owner#=1 and o2.type#=29);
380: select count(*) into c2 from dependency$ where p_obj# in
381: (select obj# from java$rmjvm$aux);
382: select count(*) into c4 from javasnm$;
383: else
384: select count(*) into c1 from syn$ where obj# in
385: (select o1.obj# from obj$ o1,obj$ o2,java$rmjvm$aux j
381: (select obj# from java$rmjvm$aux);
382: select count(*) into c4 from javasnm$;
383: else
384: select count(*) into c1 from syn$ where obj# in
385: (select o1.obj# from obj$ o1,obj$ o2,java$rmjvm$aux j
386: where o1.name=o2.name and o1.type#=5 and o1.owner#=1
387: and o2.obj#=j.obj#);
388: select count(*) into c2 from dependency$ where p_obj# in
389: (select obj# from obj$ where
391: c4 := 0;
392: end if;
393:
394: select count(*) into c3 from objauth$ where obj# in
395: (select obj# from java$rmjvm$aux);
396: select count(*) into c6 from javaobj$ where obj# in
397: (select obj# from java$rmjvm$aux);
398: select count(*) into c5 from access$ where d_obj# in
399: (select obj# from java$rmjvm$aux);
393:
394: select count(*) into c3 from objauth$ where obj# in
395: (select obj# from java$rmjvm$aux);
396: select count(*) into c6 from javaobj$ where obj# in
397: (select obj# from java$rmjvm$aux);
398: select count(*) into c5 from access$ where d_obj# in
399: (select obj# from java$rmjvm$aux);
400:
401: update java$jvm$status set rmjvmtime = (select startup_time from v$instance);
395: (select obj# from java$rmjvm$aux);
396: select count(*) into c6 from javaobj$ where obj# in
397: (select obj# from java$rmjvm$aux);
398: select count(*) into c5 from access$ where d_obj# in
399: (select obj# from java$rmjvm$aux);
400:
401: update java$jvm$status set rmjvmtime = (select startup_time from v$instance);
402:
403: IF c1 = 0 AND c2 = 0 AND c3 = 0 AND c4 = 0 AND c5 = 0 and c6 = 0 THEN
397: (select obj# from java$rmjvm$aux);
398: select count(*) into c5 from access$ where d_obj# in
399: (select obj# from java$rmjvm$aux);
400:
401: update java$jvm$status set rmjvmtime = (select startup_time from v$instance);
402:
403: IF c1 = 0 AND c2 = 0 AND c3 = 0 AND c4 = 0 AND c5 = 0 and c6 = 0 THEN
404: select count(*) into total_to_delete
405: from obj$ where obj# in (select obj# from java$rmjvm$aux);
401: update java$jvm$status set rmjvmtime = (select startup_time from v$instance);
402:
403: IF c1 = 0 AND c2 = 0 AND c3 = 0 AND c4 = 0 AND c5 = 0 and c6 = 0 THEN
404: select count(*) into total_to_delete
405: from obj$ where obj# in (select obj# from java$rmjvm$aux);
406: commit;
407: loop
408: initjvmaux.rollbackset;
409: delete from obj$ where obj# in (select obj# from java$rmjvm$aux)
405: from obj$ where obj# in (select obj# from java$rmjvm$aux);
406: commit;
407: loop
408: initjvmaux.rollbackset;
409: delete from obj$ where obj# in (select obj# from java$rmjvm$aux)
410: and rownum <= deletions_per_iteration;
411: commit;
412: exit when total_to_delete <= deletions_per_iteration;
413: total_to_delete := total_to_delete - deletions_per_iteration;
419: end if;
420:
421: commit;
422: initjvmaux.rollbackset;
423: delete from java$rmjvm$aux;
424:
425: commit;
426: initjvmaux.rollbackset;
427:
424:
425: commit;
426: initjvmaux.rollbackset;
427:
428: insert into java$rmjvm$aux
429: (select obj# from obj$ where type#=10 and owner#=1);
430: delete from java$rmjvm$aux
431: where obj# in (select p_obj# from dependency$);
432: delete from obj$ where obj# in (select obj# from java$rmjvm$aux);
426: initjvmaux.rollbackset;
427:
428: insert into java$rmjvm$aux
429: (select obj# from obj$ where type#=10 and owner#=1);
430: delete from java$rmjvm$aux
431: where obj# in (select p_obj# from dependency$);
432: delete from obj$ where obj# in (select obj# from java$rmjvm$aux);
433: commit;
434: delete from java$rmjvm$aux;
428: insert into java$rmjvm$aux
429: (select obj# from obj$ where type#=10 and owner#=1);
430: delete from java$rmjvm$aux
431: where obj# in (select p_obj# from dependency$);
432: delete from obj$ where obj# in (select obj# from java$rmjvm$aux);
433: commit;
434: delete from java$rmjvm$aux;
435: commit;
436:
430: delete from java$rmjvm$aux
431: where obj# in (select p_obj# from dependency$);
432: delete from obj$ where obj# in (select obj# from java$rmjvm$aux);
433: commit;
434: delete from java$rmjvm$aux;
435: commit;
436:
437: dbms_output.put_line('All java objects removed');
438: ELSE
438: ELSE
439: dbms_output.put_line('c1: '||c1||' c2: '||c2||' c3: '||c3||
440: ' c4: '||c4||' c5: '||c5||' c6: '||c6);
441: dbms_output.put_line('Java objects not completely removed. ' ||
442: 'Rerun rmjvm.run');
443: END IF;
444: END;
445:
446: end;
466: end loop;
467: return y;
468: end;
469:
470: procedure check_for_rmjvm as
471: foo exception;
472: pragma exception_init(foo,-28);
473: ct number;
474: begin
474: begin
475: -- check whether registry says startup is pending
476: if initjvmaux.startup_pending_p then raise foo; end if;
477: -- check whether there are any KGL handles for non fixed objects which
478: -- do not appear in obj$. This can indicate that rmjvm has run in the
479: -- current instance
480: -- Ignore SYS temp tables created during optimizer statstics
481: -- collection.
482: select count(*) into ct from x$kglob,obj$ where
500: initjvmaux.rollbacksetup;
501: commit;
502: initjvmaux.rollbackset;
503:
504: delete from java$rmjvm$aux;
505:
506: exec('insert into java$rmjvm$aux (select joxftobn from x$joxfc ' ||
507: 'where bitand(joxftflags,96)=0)');
508:
502: initjvmaux.rollbackset;
503:
504: delete from java$rmjvm$aux;
505:
506: exec('insert into java$rmjvm$aux (select joxftobn from x$joxfc ' ||
507: 'where bitand(joxftflags,96)=0)');
508:
509: commit;
510: initjvmaux.rollbackset;
508:
509: commit;
510: initjvmaux.rollbackset;
511:
512: exec('create or replace java source named java$rmjvm$src as import java.lang.Object;');
513:
514: commit;
515: initjvmaux.rollbackset;
516:
521: already_done number := 0;
522: cursor C1(above number) is select
523: 'ALTER JAVA CLASS "' || u.name || '"."' || o.name || '" RESOLVE',
524: o.obj# from
525: obj$ o, user$ u, java$rmjvm$aux j where
526: o.obj#=j.obj# and u.user# = o.owner# and j.obj# > above
527: order by j.obj#;
528:
529: DDL_CURSOR integer;
574: commit;
575:
576: initjvmaux.rollbackset;
577:
578: exec('drop java source java$rmjvm$src');
579: delete from java$rmjvm$aux;
580:
581: commit;
582:
575:
576: initjvmaux.rollbackset;
577:
578: exec('drop java source java$rmjvm$src');
579: delete from java$rmjvm$aux;
580:
581: commit;
582:
583: initjvmaux.rollbackcleanup;