osstat.sql
code:SQL
whenever sqlerror exit rollback
insert into perfstat.USER$OSSTAT (
SDATE
,IDLE_TIME
,BUSY_TIME
,USER_TIME
,SYS_TIME
,IOWAIT_TIME
,NICE_TIME
,LOAD
)
select
sysdate sdate
,sum(decode(OSSTAT_ID, 1,VALUE,0)) IDLE_TIME
,sum(decode(OSSTAT_ID, 2,VALUE,0)) BUSY_TIME
,sum(decode(OSSTAT_ID, 3,VALUE,0)) USER_TIME
,sum(decode(OSSTAT_ID, 4,VALUE,0)) SYS_TIME
,sum(decode(OSSTAT_ID, 5,VALUE,0)) IOWAIT_TIME
,sum(decode(OSSTAT_ID, 6,VALUE,0)) NICE_TIME
,sum(decode(OSSTAT_ID,15,VALUE,0)) LOAD
from v$osstat where OSSTAT_ID between 1 and 15;
commit;