-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Author       : Sameer S Choudhari
-- Description  : Install Oracle JVM component
-- Call Syntax  : @oracle_jvm_installation.sql
-- Last Modified: 17/03/2015
-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONNECT / AS SYSDBA
SET ECHO ON LINES 200 PAGES 49999 TIME ON TIMING ON SERVEROUTPUT ON 
SPOOL oracle_jvm_installation.LOG;
STARTUP MOUNT
ALTER SYSTEM SET "_system_trig_enabled" = FALSE SCOPE=MEMORY;
ALTER DATABASE OPEN;
--ALTER SYSTEM SET java_pool_size=48M scope=SPFILE sid='*';
@?/javavm/install/initjvm.SQL
--@?/xdk/admin/initxml.sql
--@?/xdk/admin/xmlja.sql
--@?/rdbms/admin/catjava.sql
--@?/rdbms/admin/catexf.sql

--JVM Healthcheck 
COLUMN comp_name FORMAT a60
COLUMN status FORMAT a20
SHOW PARAMETER pool_size
SHOW PARAMETER SGA
SELECT comp_id,comp_name,VERSION,status,SCHEMA FROM dba_registry;  
SELECT OWNER, object_type,   COUNT(*) FROM dba_objects WHERE object_type LIKE '%JAVA%' AND OWNER='JAVAVM' AND status <> 'VALID' GROUP BY OWNER,   object_type;
SELECT ROLE FROM dba_roles WHERE ROLE LIKE '%JAVA%';
SELECT * FROM v$sgastat WHERE pool = 'java pool' OR NAME = 'free memory';
SELECT OWNER, object_type,  status, dbms_java.longname(object_name) FROM dba_objects WHERE object_type LIKE '%JAVA%' AND status <> 'VALID';
SPOOL OFF