set lines 120 pages 200
col dd format a20
col inst_id format 99
col metric_name format a30
col value format 99.99
select x.dd, x.inst_id, x.metric_name, x.value "%CPU", y.sess
from
(select to_char(sysdate, 'DD-MON-RRRR:HH24:MI') DD, inst_id, metric_name, value
from gv$sysmetric
where metric_name like 'Host CPU Utilization%' and group_id=2 ) x,
(select inst_id, count(1) sess from gv$session
where status = 'ACTIVE' and osuser != 'oracle'
group by inst_id) y
where x.inst_id = y.inst_id
order by x.inst_id;