SELECT e.ID_USUARIO, u.NOME_COMPLETO USUARIO, e.ID_USUARIO_SOLICITANTE , us.NOME_COMPLETO USUARIO_SOLICITANTE, e.DATA_EMPRESTIMO DATA_EMPRESTIMO, e.DATA_DEVOLUCAO DATA_DEVOLUCAO,
e.STATUS STATUS, l.TITULO
FROM emprestimo e
INNER JOIN usuario u ON e.ID_USUARIO = u.ID
INNER JOIN usuario us ON e.ID_USUARIO_SOLICITANTE = us.ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Based on https://wiki.postgresql.org/wiki/Disk_Usage | |
---- To use on zabbix for LLD | |
---- Sorted to the greatest size to the lowest size | |
WITH index_stats AS ( | |
SELECT | |
pg_class.oid, | |
nspname AS table_schema, | |
relname AS index_NAME, | |
pg_total_relation_size(pg_class.oid) AS total_bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Based on https://wiki.postgresql.org/wiki/Disk_Usage | |
---- To use on zabbix for LLD | |
---- Sorted to the greatest size to the lowest size | |
WITH table_stats AS ( | |
SELECT | |
pg_class.oid, | |
nspname AS table_schema, | |
relname AS TABLE_NAME, | |
pg_class.reltuples AS row_estimate, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
pga_job.jobname as job_name, | |
pga_jobstep.jstdbname as database_name, | |
pgagent.pga_next_schedule( | |
pga_schedule.jscid, | |
pga_schedule.jscstart, | |
pga_schedule.jscend, | |
pga_schedule.jscminutes, | |
pga_schedule.jschours, | |
pga_schedule.jscweekdays, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Found on: http://techxploration.blogspot.com.br/2012/06/script-to-get-oracle-database-size.html | |
SET SERVEROUTPUT ON | |
Declare | |
ddf Number:= 0; | |
dtf Number:= 0; | |
log_bytes Number:= 0; | |
total Number:= 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PGCONFIG_URL="https://api.pgconfig.org/v1/tuning/get-config" | |
DEFAULT_FORMAT="alter_system" | |
ENVIRONMENT="{{ postgresql_default_profile }}" | |
PG_VERSION="{{ postgresql_version }}" | |
TOTAL_RAM=$(({{ ansible_memtotal_mb }} /1024)) | |
ADMIN_USER="postgres" | |
USE_RESTORE_TUNING="{{ apply_restore_tuning | default('NO') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based on http://pastebin.com/igga50QK | |
CREATE OR REPLACE FUNCTION fn_busca_valor_bloco_sql(p_blccodigo INTEGER, p_itemcodigo INTEGER, p_cadastro BIGINT) | |
RETURNS TEXT AS | |
$BODY$ | |
SELECT | |
CASE WHEN lsicodigo IS NULL THEN lsidescricao ELSE itmconteudo END | |
FROM tbblocoitem | |
LEFT JOIN tblistaitem using(blccodigo ,itemcodigo ,lsicodigo) | |
WHERE tbblocoitem.blccodigo = p_blccodigo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## check_dump.sh | |
### Verifica a integridade do backup, convertendo ele do tipo diretório para SQL Plain | |
### Procura por arquivos .tar no diretório `DUMP_DIR`, extrai eles no `TEMP_DIR` e efetua o teste | |
## Baseado na idéia do @fabriziomello | |
######### | |
function show_usage() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- set_fact: | |
events_session: |+ | |
events { | |
worker_connections {{ total_fpm_pools * max_phpfpm_server_per_pool }}; | |
use epoll; | |
multi_accept on; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ideia original do @matheusoliveira | |
# $1 é %f, $2 é %p | |
## IMPORTANTE: Lembrar de configurar o `archive_cleanup_command` no `recovery.conf` pra | |
## chamar o pg_archivecleanup e apontar pro ${CACHE_DIR} | |
## exemplo: | |
### restore_command = '/opt/resources/wal_prefetch.sh %f %p' | |
### archive_cleanup_command = '/usr/pgsql-9.3/bin/pg_archivecleanup /slave/wal-cache %r' |