Merge pull request #301 from Gilum/patch-4

+ Update request for oracle >= 11
This commit is contained in:
qgarnier 2016-01-25 17:01:19 +01:00
commit ade8b4e35b

View File

@ -67,7 +67,24 @@ sub run {
$self->{sql}->connect();
my $query;
if ($self->{sql}->is_version_minimum(version => '9')) {
if ($self->{sql}->is_version_minimum(version => '11')) {
$query = q{
SELECT
tum.tablespace_name "Tablespace",
t.status "Status",
t.contents "Type",
t.extent_management "Extent Mgmt",
tum.used_space*t.block_size bytes,
tum.tablespace_size*t.block_size bytes_max
FROM
DBA_TABLESPACE_USAGE_METRICS tum
INNER JOIN
dba_tablespaces t on tum.tablespace_name=t.tablespace_name
WHERE
t.contents<>'UNDO'
OR (t.contents='UNDO' AND t.tablespace_name =(SELECT value FROM v$parameter WHERE name='undo_tablespace'))
};
} elsif ($self->{sql}->is_version_minimum(version => '9')) {
$query = q{
SELECT
a.tablespace_name "Tablespace",
@ -274,7 +291,13 @@ sub run {
$status = lc $status;
$type = lc $type;
my ($percent_used, $percent_free, $used, $free, $size);
if ((!defined($bytes_max)) || ($bytes_max == 0)) {
if ($self->{sql}->is_version_minimum(version => '11')) {
$percent_used = $bytes / $bytes_max * 100;
$size = $bytes_max;
$free = $bytes_max - $bytes;
$used = $bytes;
}
elsif ((!defined($bytes_max)) || ($bytes_max == 0)) {
$percent_used = ($bytes - $bytes_free) / $bytes * 100;
$size = $bytes;
$free = $bytes_free;