SELECT 'ALTER '||
           decode(object_type, 'PACKAGE BODY', 'PACKAGE',
                  object_type) || ' ' ||
           owner||'.'||
           object_name||' compile' ||
           decode(object_type, 'PACKAGE BODY', ' BODY') || ';' OUT_PUT
      FROM dba_objects
     WHERE status = 'INVALID'
       ANd OWNER in  ('SYS')
And OBJECT_NAME not like '%BIN$%'
and object_type in ( 'PACKAGE',
                            'PACKAGE BODY',
                            'PROCEDURE','FUNCTION',
                            'VIEW',
                            'TRIGGER' );



select a.inst_id,trunc(last_call_et/60,0) "Time (Min)",
username,osuser,sid||', '||serial# "SS",
to_char(logon_time, 'mm/dd/yyyy hh24:mi:ss') "LOGON", sql_text 
from gv$session a, gv$sqlarea b 
where status='ACTIVE' 
and a.inst_id = b.inst_id 
and a.sql_address = b.address 
and a.sql_hash_value = b.hash_value 
and a.username is not null 
and a.username like '%SYS%' 
and trunc(last_call_et/60,0) > 30;
