[Postgres] Découverte d’une DB

Découverte d’une base postgres SELECT schemaname as table_schema, relname as table_name, n_live_tup as row_count FROM pg_stat_user_tables ORDER BY n_live_tup DESC; echo ===================================echo OBJECT COUNTecho ==================================SELECT    n.nspname as schema_name    ,CASE. read more…

[SYSTEM]

This script uses the local tnsnames.ora file to create a connection, and requires the variable ${p} to hold the current SYSTEM password. #on récupère le mdp systeme[[ -z « ${p} » ]]. read more…

Status instance postgres

POSTGRES_IS_RUNNING=$(export PGPASSWORD=${PG_PWD}; psql –host=${MACH_DEST} –port=${PORT} –user=${PG_USER} –dbname=postgres –quiet –tuples-only –no-psqlrc –command « SELECT 1; » 2>/dev/null)INSTANCE_STATUS=$(export PGPASSWORD=${PG_PWD}; psql –host=${MACH_DEST} –port=${PORT} –user=${PG_USER} –dbname=postgres –quiet –tuples-only –no-psqlrc –command= »SELECT CASE pg_is_in_recovery() WHEN true THEN ‘IN. read more…

Author avatar

Translate »