Skip to content

Commit

Permalink
Fixed Temporary Tablespace
Browse files Browse the repository at this point in the history
  • Loading branch information
floyd871 committed Nov 27, 2017
1 parent dec1304 commit b3cdb8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,16 @@ func (e *Exporter) ScrapeTablespace() {
getsize AS (SELECT tablespace_name, SUM(bytes) tsize
FROM dba_data_files GROUP BY tablespace_name),
getfree as (SELECT tablespace_name, contents, SUM(blocks*block_size) tfree
FROM DBA_LMT_FREE_SPACE a, v$tablespace b, dba_tablespaces c where a.TABLESPACE_ID= b.ts# and b.name=c.tablespace_name
FROM DBA_LMT_FREE_SPACE a, v$tablespace b, dba_tablespaces c
WHERE a.TABLESPACE_ID= b.ts# and b.name=c.tablespace_name
GROUP BY tablespace_name,contents)
SELECT a.tablespace_name, b.contents, a.tsize, b.tfree
FROM GETSIZE a, GETFREE b
WHERE a.tablespace_name = b.tablespace_name`)
WHERE a.tablespace_name = b.tablespace_name
UNION
SELECT tablespace_name, 'TEMPORARY', sum(tablespace_size), sum(free_space)
FROM dba_temp_free_space
GROUP BY tablespace_name`)
if err != nil {
break
}
Expand Down

0 comments on commit b3cdb8c

Please sign in to comment.