Skip to main content

Bom dia pessoal.

Gostaria de compartilhar com vocês algumas queries úteis que utilizamos para administração do ambiente de backup

  • POSTGRES

Select * from "backup.model.backuptasksessions" where creation_time >= NOW() - INTERVAL '60 DAYS' order by creation_time desc

Registros de backups efetuados nos últimos 60 dias

COPY (Select * from "backup.model.backuptasksessions" where creation_time >= NOW() - INTERVAL '60 DAYS' order by creation_time desc) to 'C:\arquivo.csv' DELIMITER ',' CSV;

Exportar resultado da query para um arquivo .csv

select count (*) as qty
from
(select distinct session_id from "backup.model.backuptasksessions"
where status='0' and creation_time >= NOW() - INTERVAL '24 HOURS') tb;
select count (*) as qty
from
(select distinct session_id from "backup.model.backuptasksessions"
where status!='0' and status!='3' and creation_time >= NOW() - INTERVAL '24 HOURS') tb;
select count (*) as qty
from
(select * from "backup.model.backuptasksessions"
where status='3' and creation_time >= NOW() - INTERVAL '24 HOURS') tb;

Execuções com sucesso/falha/alerta (sequencialmente) nas últimas 24 horas

select Count(*) from "tape.tape_mediums"

Quantidade de fitas catalogadas

SELECT SUM(cast(totalspace / 1024. / 1024. / 1024. / 1024. as decimal(10,2))) FROM backuprepositorycontainerview

Espaço usado no repositório (Em TB)

SELECT SUM(cast(freespace / 1024. / 1024. / 1024. / 1024. as decimal(10,2))) FROM backuprepositorycontainerview

Espaço livre no repositório (Em TB)

SELECT SUM(cast(totalspace / 1024. / 1024. / 1024. / 1024. as decimal(10,2))) - SUM(cast(freespace / 1024. / 1024. / 1024. / 1024. as decimal(10,2))) FROM backuprepositorycontainerview

Tamanho total do repositório (Em TB)

Be the first to comment!

Comment