update fra-usage for oracle 10

This commit is contained in:
garnier-quentin 2019-09-25 13:20:43 +02:00
parent 7f86397bed
commit 28413bff7e
1 changed files with 22 additions and 12 deletions

View File

@ -76,26 +76,36 @@ sub manage_selection {
my ($self, %options) = @_;
$options{sql}->connect();
$options{sql}->query(query => q{
SELECT file_type, percent_space_used, percent_space_reclaimable
FROM v$recovery_area_usage
});
if ($self->{sql}->is_version_minimum(version => '11')) {
$options{sql}->query(query => q{
SELECT file_type, percent_space_used, percent_space_reclaimable
FROM v$recovery_area_usage
});
} else {
$options{sql}->query(query => q{
SELECT name, space_used, space_reclaimable, space_limit
FROM v$recovery_file_dest
});
}
my $result = $options{sql}->fetchall_arrayref();
$options{sql}->disconnect();
$self->{file} = {};
foreach my $row (@$result) {
if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
$$row[0] !~ /$self->{option_results}->{filter_type}/i) {
$self->{output}->output_add(long_msg => "skipping '" . $$row[0] . "': no matching filter.", debug => 1);
$row->[0] !~ /$self->{option_results}->{filter_type}/i) {
$self->{output}->output_add(long_msg => "skipping '" . $row->[0] . "': no matching filter.", debug => 1);
next;
}
$self->{file}->{$$row[0]} = {
display => $$row[0],
percent_space_usage => $$row[1],
percent_space_reclaimable => $$row[2],
};
$self->{file}->{$row->[0]} = { display => $row->[0] };
if ($self->{sql}->is_version_minimum(version => '11')) {
$self->{file}->{$row->[0]}->{percent_space_usage} = $row->[1];
$self->{file}->{$row->[0]}->{percent_space_reclaimable} = $row->[2];
} else {
$self->{file}->{$row->[0]}->{percent_space_usage} = $row->[1] * 100 / $row->[3];
$self->{file}->{$row->[0]}->{percent_space_reclaimable} = $row->[2] * 100 / $row->[3];
}
}
if (scalar(keys %{$self->{file}}) <= 0) {