# Oracle DB extension autoextendable tablespaces size metric

**URL:** <https://community.dynatrace.com/t/oracle-db-extension-autoextendable-tablespaces-size-metric/48585>\
**Category:** Extensions\
**Tags:** databases, oracle, extensions\
**Created:** [October 28, 2024, 2:37pm UTC](https://community.dynatrace.com/t/oracle-db-extension-autoextendable-tablespaces-size-metric/48585 "2024-10-28T14:37:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 28, 2024, 2:37pm UTC](https://community.dynatrace.com/t/oracle-db-extension-autoextendable-tablespaces-size-metric/48585/1 "2024-10-28T14:37:35Z")

</div>

Hello

customer has autoextendable tablespaces used in their Oracle DBs and Used % metric (Metric key​ com.dynatrace.extension.sql-oracle.tablespaces.usage) doesn’t really show it’s real used space. They use custom sql query to achieve % used based on free space available for autoextension. So if Dynatrace extention shows 92% usage, script shows 25% (considering total extendable space for datafile). Would it be possible to include this kind of metric into Oracle DB Extension?

Part of query is:

```auto
AUTOEXTEND AS (SELECT tablespace_name, round (SUM (size_to_grow),2) total_growth_tbs FROM (SELECT tablespace_name, round (SUM (maxbytes)/1024/1024,2) size_to_grow FROM dba_data_files WHERE autoextensible = 'YES' GROUP BY tablespace_name UNION SELECT tablespace_name, round (SUM (BYTES)/1024/1024,2) size_to_grow FROM dba_data_files WHERE autoextensible = 'NO' GROUP BY tablespace_name) GROUP BY tablespace_name)

```

As you can see they use SUM (maxbytes), where AUTOEXTENSIBLE = “YES” and (SUM (BYTES), where AUTOEXTENSIBLE = “NO”.

---

<div class="post-metadata">

**Author:** ![Tom\_sSeroteRoos](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@Tom\_sSeroteRoos](https://community.dynatrace.com/u/Tom_sSeroteRoos)\
**Post date:** [October 29, 2024, 1:37pm UTC](https://community.dynatrace.com/t/oracle-db-extension-autoextendable-tablespaces-size-metric/48585/2 "2024-10-29T13:37:32Z")

</div>

The extension currently uses CDB\_TABLESPACE\_USAGE\_METRICS which according to [Oracle’s documentation](https://docs.oracle.com/en/database/oracle/oracle-database/21/refrn/DBA_TABLESPACE_USAGE_METRICS.html) already takes into account auto-extensible datafiles:

> The maximum size of the tablespace, expressed as number of data blocks
> 
> - If the tablespace contains any datafiles with autoextend enabled, then this column displays the maximum size to which the tablespace can grow. Underlying storage free space, such as Oracle ASM or file system storage, is also taken into account when computing this value.
> 
> - If the tablespace contains only datafiles with autoextend disabled, then this column displays the combined size of all datafiles in the tablespace.

In the past we had a similar query to the one you show, but the trouble is we had to keep adjusting it since there were always edge cases to consider. The thought was that by using Oracle’s official view for tablespace usage we would get the most accurate metrics. And indeed most customers report that these metrics provide the accurate value.

If in your case you see a discrepancy in what you expect vs. what is actually reported in this view, maybe it makes sense to, in a first instance, reach out to Oracle? As I hope you can understand, we are reticent to make these kind of potentially breaking changes while we know that for most customers the data is reported fine.

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 29, 2024, 2:19pm UTC](https://community.dynatrace.com/t/oracle-db-extension-autoextendable-tablespaces-size-metric/48585/3 "2024-10-29T14:19:23Z")

</div>

Thanks, now i see that this should show correct values. I will check why extension’s query for TBSP space shows low values for Total space metric (com.dynatrace.extension.sql-oracle.tablespaces.totalSpace) at customer’s db and post update asap (will check what extension’s query in tablespaces featureset returns).

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 30, 2024, 4:16pm UTC](https://community.dynatrace.com/t/oracle-db-extension-autoextendable-tablespaces-size-metric/48585/4 "2024-10-30T16:16:25Z")

</div>

Now i have customer’s dba info and it seems that there was confusion with actual Oracle TBSP USAGE metrics. They historicaly used some inhouse solution, probably from past times, when maybe DBA\_TABLESPACE\_USAGE\_METRICS view didn’t exist (introduced from 11.2 as i digged in history) 😉

---

<div class="post-metadata">

**Author:** ![Tom\_sSeroteRoos](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@Tom\_sSeroteRoos](https://community.dynatrace.com/u/Tom_sSeroteRoos)\
**Post date:** [October 31, 2024, 7:29am UTC](https://community.dynatrace.com/t/oracle-db-extension-autoextendable-tablespaces-size-metric/48585/5 "2024-10-31T07:29:29Z")

</div>

I see! Then I take it everything is fine using this view?

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 31, 2024, 7:40am UTC](https://community.dynatrace.com/t/oracle-db-extension-autoextendable-tablespaces-size-metric/48585/6 "2024-10-31T07:40:35Z")

</div>

As they were used to their own monitoring style for a long ages it will take some time to deal with requests for some “extra” metrics. But yes, they understood the message. Thanks for explanation.
