Update tablespaceusage.pm
Add a spesific sql request for Oracle >= 11 The new sql request used Oracle View DBA_TABLESPACE_USAGE_METRICS Reduces the time of the request by the 20 large database
This commit is contained in:
parent
0ec07f5846
commit
caa31d76dd
|
@ -67,7 +67,24 @@ sub run {
|
||||||
|
|
||||||
$self->{sql}->connect();
|
$self->{sql}->connect();
|
||||||
my $query;
|
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{
|
$query = q{
|
||||||
SELECT
|
SELECT
|
||||||
a.tablespace_name "Tablespace",
|
a.tablespace_name "Tablespace",
|
||||||
|
@ -274,7 +291,13 @@ sub run {
|
||||||
$status = lc $status;
|
$status = lc $status;
|
||||||
$type = lc $type;
|
$type = lc $type;
|
||||||
my ($percent_used, $percent_free, $used, $free, $size);
|
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;
|
$percent_used = ($bytes - $bytes_free) / $bytes * 100;
|
||||||
$size = $bytes;
|
$size = $bytes;
|
||||||
$free = $bytes_free;
|
$free = $bytes_free;
|
||||||
|
|
Loading…
Reference in New Issue