升级生产的DB,有一些预检查条件,这些需要提前修复,以便在升级的时候不会成为影响进度的绊脚石。
生产中的components有一些显示是invalid状态,从dba_registry中可以查到。
select comp_id,comp_name,status,version from dba_Registry;
还有一些显示是loading.
COMP_ID COMP_NAME VERSION STATUS
------------------------------ -------------------- ------------------------------ -----------
CATALOG Oracle Database Cata 10.2.0.1.0 VALID
log Views
CATPROC Oracle Database Pack 10.2.0.1.0 VALID
ages and Types
JAVAVM JServer JAVA Virtual LOADING
Machine
让我百思不得其解。
如果显示是Loading,很可能是安装JVM的时候失败。我上次的日志如下。安装没有成功。
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL> -- Prevent the script. from continuing in the case where create java system
SQL> -- detects existing java classes or there is any other kind of error.
SQL> whenever sqlerror exit;
SQL>
SQL> -- Load all the Java classes
SQL> begin if initjvmaux.startstep('CREATE_JAVA_SYSTEM') then
2 initjvmaux.rollbacksetup;
3 commit;
4 initjvmaux.rollbackset;
5 initjvmaux.exec('create or replace java system');
6 commit;
7 initjvmaux.rollbackcleanup;
8 initjvmaux.endstep;
9 end if; end;
10 /
create or replace java system
begin if initjvmaux.startstep('CREATE_JAVA_SYSTEM') then
*
ERROR at line 1:
ORA-01653: unable to extend table SYS.IDL_UB1$ by 1024 in tablespace SYSTEM
ORA-06512: at "SYS.INITJVMAUX", line 23
ORA-06512: at line 5
SQL> col comp_name format a20
SQL> /
COMP_ID COMP_NAME VERSION STATUS
------------------------------ -------------------- ------------------------------ -----------
CATALOG Oracle Database Cata 10.2.0.1.0 VALID
log Views
CATPROC Oracle Database Pack 10.2.0.1.0 VALID
ages and Types
JAVAVM JServer JAVA Virtual LOADING
Machine
生产环境中有的组件显示是invalid,有的组件显示是loading.
对于这种情况,联系之前的系统迁移,原因是之前系统在Unix下,迁移到linux的时候,先用传输表空间(sys下的Objects就没有导出),在迁移后就留下了隐患。尽管之后又用goldengate来做同步,但是那部分objects还是没法同步导致的。
现在来修复一下这个问题,对于invalid,loaded,loading的修复如下:
SQL> select count(*),owner,status from all_objects where object_Type like 'JAVA%' group by owner,status;
COUNT(*) OWNER STATUS
---------- ------------------------------ -------
11999 SYS VALID
--这个数据明显和预计的差别很大。
需要卸载重新安装。
步骤如下:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> spool full_rmjvm.log
SQL> set echo on
SQL> startup mount
ORACLE instance started.
Total System Global Area 369098752 bytes
Fixed Size 1219448 bytes
Variable Size 83887240 bytes
Database Buffers 276824064 bytes
Redo Buffers 7168000 bytes
Database mounted.
SQL> alter system set "_system_trig_enabled"=false scope=memory;
System altered.
SQL> alter system enable restricted session;
System altered.
SQL> alter database open;
Database altered.
run below scripts:
@?/rdbms/admin/catnoexf.sql --如果跑错,可以忽略。
@?/rdbms/admin/catnojav.sql --和java packages有关
@?/xdk/admin/rmxml.sql ---和xdk,xml component
@?/javavm/install/rmjvm.sql
and truncate $java$jvm$status;
SQL> select *from obj$ where obj#=0 and type#=0;
no rows selected
SQL> delete from obj$ where obj#=0 and type#=0;
0 rows deleted.
SQL> commit;
Commit complete.
SQL> select comp_id,comp_name,status,version from dba_registry;
COMP_ID COMP_NAME STATUS VERSION
------------------------------ -------------------------------------------------- ----------- ------------------------------
CATALOG Oracle Database Catalog Views VALID 10.2.0.1.0
CATPROC Oracle Database Packages and Types VALID 10.2.0.1.0
JAVAVM JServer JAVA Virtual Machine REMOVED
spool off;
查看日志,看有没有其他的错误。如果没有继续下面的步骤。
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> set echo on
SQL> spool full_jvminst.log
SQL> startup mount
ORACLE instance started.
Total System Global Area 369098752 bytes
Fixed Size 1219448 bytes
Variable Size 83887240 bytes
Database Buffers 276824064 bytes
Redo Buffers 7168000 bytes
Database mounted.
SQL> alter system set "_system_trig_enabled"=false scope=memory;
System altered.
SQL> alter database open;
Database altered.
SQL> @?/javavm/install/initjvm.sql
。。。。。。。很多日志。。。。。
SQL>@?/xdk/admin/initxml.sql
。。。。。。。很多日志。。。。
SQL> @?/rdbms/admin/catjava.sql
在执行的时候会耗费一些时间,开另外一个窗口查询dba_registry,就能够看到状态的变化。
SQL> /
COMP_ID COMP_NAME STATUS VERSION
------------------------------ -------------------------------------------------- ----------- ------------------------------
CATALOG Oracle Database Catalog Views VALID 10.2.0.1.0
CATPROC Oracle Database Packages and Types VALID 10.2.0.1.0
JAVAVM JServer JAVA Virtual Machine VALID 10.2.0.1.0
XML Oracle XDK VALID 10.2.0.1.0
CATJAVA Oracle Database Java Packages LOADING
SQL> /
COMP_ID COMP_NAME STATUS VERSION
------------------------------ -------------------------------------------------- ----------- ------------------------------
CATALOG Oracle Database Catalog Views VALID 10.2.0.1.0
CATPROC Oracle Database Packages and Types VALID 10.2.0.1.0
JAVAVM JServer JAVA Virtual Machine VALID 10.2.0.1.0
XML Oracle XDK VALID 10.2.0.1.0
CATJAVA Oracle Database Java Packages LOADED 10.2.0.1.0
COMP_ID COMP_NAME STATUS VERSION
------------------------------ -------------------------------------------------- ----------- ------------------------------
CATALOG Oracle Database Catalog Views VALID 10.2.0.1.0
CATPROC Oracle Database Packages and Types VALID 10.2.0.1.0
JAVAVM JServer JAVA Virtual Machine VALID 10.2.0.1.0
XML Oracle XDK VALID 10.2.0.1.0
CATJAVA Oracle Database Java Packages VALID 10.2.0.1.0
最后执行
SQL> @?/rdbms/admin/catexf.sql
成功执行后,查看状态,
COMP_ID COMP_NAME STATUS VERSION
------------------------------ -------------------------------------------------- ----------- ------------------------------
CATALOG Oracle Database Catalog Views VALID 10.2.0.1.0
CATPROC Oracle Database Packages and Types VALID 10.2.0.1.0
JAVAVM JServer JAVA Virtual Machine VALID 10.2.0.1.0
XML Oracle XDK VALID 10.2.0.1.0
CATJAVA Oracle Database Java Packages VALID 10.2.0.1.0
EXF Oracle Expression Filter VALID 10.2.0.1.0
6 rows selected.
--sanity check for component installation
SQL> select count(*),status,owner from all_objects where object_type like '%JAVA%' group by status,owner;
COUNT(*) STATUS OWNER
---------- ------- ------------------------------
15505 VALID SYS
42 VALID EXFSYS
SQL> select owner,object_type,count(*)from all_objects where object_type like '%JAVA%' and status 'VALID' group by owner,object_type;
no rows selected
check spool log . 看有没有关联的ora-错误。
最后如果没问题,证明这些组件都已经成功安装,重启数据库。