MINI MINI MANI MO
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: javavm/install/udjvmrm.sql
Rem SQL_SHIPPED_FILE: javavm/install/udjvmrm.sql
Rem SQL_PHASE: UPGRADE
Rem SQL_STARTUP_MODE: UPGRADE
Rem SQL_IGNORABLE_ERRORS: NONE
Rem END SQL_FILE_METADATA
-- Subscript for upgrade/downgrade to call to remove system classes
-- and support packages on downgrade, or upgrade them on upgrade.
-- This script can not function properly in SVRMGR. The following
-- lines are intended to abort the script if it is being run with
-- SVRMGR, but will be interpreted simply as remarks by SQLPLUS.
rem -
set stoponerror on
rem -
udjvmrm.sql must be run with SQLPLUS, not SVRMGRL
-- This script may only be called from jvmdwgrd.ql or jvmdbmig.sql.
-- Otherwise, jvmudaction will be undefined and the following will
-- abort the script.
whenever sqlerror exit;
/*
/*
## If the following sequence results in
## SP2-0552: Bind variable "JVMUDACTION" not declared.
## followed by
## ORA-01476: divisor is equal to zero
## thereby causing SQLPLUS to exit, it is because this script is
## not being run as a subscript of jvmdbmig.sql or jvmdwgrd.sql, as required.
*/
variable scratch varchar2(30)
execute :scratch := :jvmudaction; :scratch := 'not null';
declare z number := 0; begin if :scratch is null then z := 1/z;end if;end;
/
whenever sqlerror continue;
call initjvmaux.drp('drop table JACCELERATOR$DLLS');
call initjvmaux.drp('drop table JACCELERATOR$DLL_ERRORS');
call initjvmaux.drp('drop table JACCELERATOR$STATUS');
variable jvmrmaction varchar2(30)
execute :jvmrmaction := 'GRADE_REMOVAL';
delete from java$rmjvm$aux;
commit;
@@jvmrm
call initjvmaux.drp('drop table JAVA$CLASS$MD5$TABLE');
column jvmuscript new_value jvmuscript noprint;
select initjvmaux.jvmuscript(:jvmpatchset) as jvmuscript from dual;
select '&jvmuscript',initjvmaux.registrystatus,:jvmdownto from dual;
begin
if initjvmaux.registrystatus = 'DOWNGRADING' and
initjvmaux.startstep('SET_REGISTRY_DOWNGRADED') then
dbms_registry.downgraded('JAVAVM',:jvmdownto);
initjvmaux.endstep;
end if;
end;
/
begin
if initjvmaux.startstep('DROP_SROS') then
initjvmaux.drop_sros;
initjvmaux.endstep;
end if;
end;
/
delete from java$rmjvm$aux;
commit;
begin
if initjvmaux.registrystatus = 'UPGRADING' and
initjvmaux.startstep('CLEAN_DEPENDENCIES') then
initjvmaux.rollbacksetup;
commit;
initjvmaux.rollbackset;
insert into java$rmjvm$aux (select unique(obj#) from obj$,dependency$
where type#=29 and d_obj#=obj# and bitand(flags,64)=64);
commit;
initjvmaux.rollbackset;
delete from java$rmjvm$aux where (select joxftflags from x$joxfc
where joxftobn=obj# and bitand(joxftflags, 96)!=0) is null;
commit;
initjvmaux.rollbackcleanup;
initjvmaux.endstep;
end if;
end;
/
delete from java$rmjvm$aux;
commit;
begin
if initjvmaux.registrystatus = 'UPGRADING' and
initjvmaux.startstep('FIX_DEPENDENCY_TIMESTAMPS') then
initjvmaux.rollbacksetup;
commit;
initjvmaux.rollbackset;
execute immediate 'update dependency$ set p_timestamp=(select stime from obj$ where obj#=p_obj#) where (select stime from obj$ where obj#=p_obj#)!=p_timestamp and (select type# from obj$ where obj#=p_obj#)=29 and (select owner# from obj$ where obj#=p_obj#)=0';
commit;
initjvmaux.rollbackcleanup;
initjvmaux.endstep;
end if;
end;
/
@@&&jvmuscript
begin
if initjvmaux.registrystatus = 'UPGRADING' and
initjvmaux.startstep('DROP_DEPLOY_DREGS') then
declare
last_obj number := 0;
cmd varchar2(200);
cursor c(prev_obj number) is
select obj#,
'drop java source '||u.name||'."'||nvl(longdbcs,o.name)||'"'
from obj$ o,user$ u,javasnm$
where obj#>=prev_obj and u.user#=o.owner# and short(+)=o.name and
obj# in (select /*+ unnest */unique(joxftobn)
from x$joxfs,javasnm$
where short(+)=JOXFTDERIVEDCLASSNAME and
(nvl(longdbcs,JOXFTDERIVEDCLASSNAME) like
'oracle/jaccelerator/server/%' or
nvl(longdbcs,JOXFTDERIVEDCLASSNAME) like
'oracle/aurora/deploy/%'))
order by obj#;
cursor c2(prev_obj number) is
select obj#,
'drop java class '||u.name||'."'||nvl(longdbcs,o.name)||'"'
from obj$ o,user$ u,javasnm$
where obj#>=last_obj and u.user#=o.owner# and short(+)=o.name and
o.type#=29 and
(nvl(longdbcs,o.name) like 'oracle/jaccelerator/server/%' or
nvl(longdbcs,o.name) like 'oracle/aurora/deploy/%')
order by obj#;
my_err number;
begin
loop
open c(last_obj);
my_err := 0;
loop
begin
fetch c into last_obj, cmd;
exit when c%NOTFOUND;
exception when others then
my_err := sqlcode;
if my_err = -1555 then -- snapshot too old, re-execute fetch query
exit;
else
raise;
end if;
end;
initjvmaux.drp(cmd);
end loop;
close c;
if my_err = 0 then exit; end if;
end loop;
last_obj := 0;
loop
open c2(last_obj);
my_err := 0;
loop
begin
fetch c2 into last_obj, cmd;
exit when c2%NOTFOUND;
exception when others then
my_err := sqlcode;
if my_err = -1555 then -- snapshot too old, re-execute fetch query
exit;
else
raise;
end if;
end;
initjvmaux.drp(cmd);
end loop;
close c2;
if my_err = 0 then exit; end if;
end loop;
end;
initjvmaux.endstep;
end if;
end;
/
-- end of the line in the downgrade case
begin
if :jvmudaction = 'DOWNGRADE' then
initjvmaux.endaction();
end if;
end;
/
OHA YOOOO