Catégorie : Postgresql
-
[POSTGRES] Privs d’un ROLE R/W
Exemple de création d’un rôle R/W avec les privileges. CREATE ROLE « $GRP » nologin;GRANT USAGE ON SCHEMA « $SCHE » TO « $GRP »;GRANT SELECT,UPDATE,INSERT,DELETE ON ALL TABLES IN SCHEMA « $SCHE » TO « $GRP »;GRANT USAGE ON […]
-
[Postgres] Trouver les schemas
select nspnamefrom pg_catalog.pg_namespace where nspname not like ‘pg%’ and nspname <> ‘information_schema’;
-
[Postgres] Privilege par user
WITH « names »(« name ») AS ( SELECT n.nspname AS « name » FROM pg_catalog.pg_namespace n WHERE n.nspname !~ ‘^pg_’ AND n.nspname <> ‘information_schema’ ) SELECT « name », pg_catalog.has_schema_privilege(current_user, « name », ‘CREATE’) AS « create », pg_catalog.has_schema_privilege(current_user, « name », ‘USAGE’) […]
-
[PostgreSQL] Privilèges
Privs useful to any new user created. create user « <user> » password ‘<PWD>’;GRANT USAGE ON SCHEMA <SCHEMA> TO <user>;GRANT SELECT,UPDATE,INSERT,DELETE ON ALL TABLES IN SCHEMA <SCHEMA> TO <user>;GRANT USAGE ON ALL […]
-
[Postgres] How to Enable / Disable Archive Mode
https://orahow.com/enable-disable-archive-mode-in-postgres/ Steps to Enable WAL Archiving in Postgres STEP 1: Verify archive mode is enabled or not using below command. postgres=# show archive_mode; archive_mode ————– off (1 row) postgres=# […]
-
L’extension oracle_fdw
#se connecter au serveur targetpsql -U <muyser>CREATE EXTENSION oracle_fdw;dewCREATE SERVER orasrv FOREIGN DATA WRAPPER oracle_fdw (dbserver ‘<servername>:<port>/<SID>’);des+GRANT USAGE ON FOREIGN SERVER orasrv TO <muyser>;CREATE USER MAPPING FOR <muyser> SERVER orasrv […]
-
On tire la chasse et on nettoie ?
PostgreSQL – vacuumdb – vacuumdb — ramasse les ordures et analyse une base de données PostgreSQL Synopsi – Français (runebook.dev)
-
Calcul stats PostgreSQL
for tablename in $(psql -U postgres -h $2 -d $1 -t -c « select table_name as _table from information_schema.tables t where t.table_schema=’sche_admin’ order by _table asc »); do echo $tablename […]
-
[PostgreSQL] pgBackRest sauvegarder la standby
Backup From a Standby | pgBackRest (pmatseykanets.github.io)
-
[PostgreSQL] Vérifier le statut de la réplication
On master: select * from pg_stat_replication; On replica (streaming replication in my case): select * from pg_stat_wal_receiver; On your master, pg_stat_replication provides data about ongoing replication: select client_addr, state, sent_location, write_location, […]