top of page

Database Billing Metrics

Jeff

Normal disclaimers, use at own risk, this is from my own research and not endorsed or supported by anyone.



These are the main metrics used for tracking and billing Oracle Database usage.


  • CPU Time Used - (per CDB/PDB)

  • Storage - (Data On Disk)

  • Network - (Input/Output network load I/O requests)

  • RAM Reserved - (SGA+PGA)







Here is the SQL I'm using to track metrics that can be used to determine what percentage or resources are being used by a DB, and in some cases down to the PDB level. How far back you can go is determined by how long your snapshots are stored.



--Allocated RAM

select

sum(value)/1024/1024/1024 as MemoryGB

from v$parameter

where name in ('pga_aggregate_limit','sga_max_size')


--Storage Size

select name,

trunc(total_size/1024/1024/1024,2) PDB_SIZE

from v$pdbs


select

trunc(sum(total_size)/1024/1024/1024,2) CDB_SIZE

from v$pdbs



--Network IO Per Container


select --count(snap_id),

--metric_name,

nvl(p.name, 'ROOT'),

trunc(sum(to_number(average)),2) neworkio

--s.con_id,

from DBA_HIST_CON_SYSMETRIC_SUMM s

left join v$pdbs p

on s.con_id=p.con_id

where upper(metric_name) like '%NETWORK TRAFFIC VOLUME PER SEC%'

and begin_time like '%08-SEP-21%'

--and begin_time like trunc(systimestamp)-1

group by p.name

order by 2 desc



--CPU Usage

select --count(snap_id),

--metric_name,

nvl(p.name, 'ROOT'),

trunc(sum(to_number(average)),2) cpu_use

--s.con_id,

from DBA_HIST_CON_SYSMETRIC_SUMM s

left join v$pdbs p

on s.con_id=p.con_id

where upper(metric_name) like '%CPU USAGE PER SEC%'

and begin_time like '%08-SEP-21%'

--and begin_time like trunc(systimestamp)-1

group by p.name

order by 2 desc


49 views0 comments

Recent Posts

See All

コメント


Never Miss a Post. Subscribe Now!

Thanks for submitting!

© 2023-2024 Jeff Lowe Tech Blog

bottom of page