Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Script to taking postgres DDL backup with their table file name on particular schema

In this shell script will help you to take the backup of postgresql table definition with their table file name automatically. 
The table DDL backup will be taken automatically with seperate file name means table file,
# Config:
DB="DBA"
U=enterprisedb
export PGPASSWORD="tcs45"
export PGPORT="5444"
export PGHOST="20.0.4.101"

TABLES="$(/opt/edb/as9.6/bin/psql -d $DB -U $U -t -c "SELECT table_name FROM
information_schema.tables WHERE table_schema='billing'")"
for table in $TABLES; do
  echo backup $table ...
/opt/edb/as9.6/bin/pg_dump -d $DB -U $U -w -st billing.$table > /home/Admin/2ndquadrant.in/HealthCraft_DC/schemas/billing/tables/billing.$table;
done;
cd /home/Admin/2ndquadrant.in/HealthCraft_DC/schemas/billing/tables
ls -lh
echo done
Note : Here billing is the schema name DBA is the database name so you can change the database and schema name as per your convenient.

Comments

Popular posts from this blog

Pgbadger Feature In Postgresql

rman interview and scenario based questions and answer and also rman(backup and recovery) discussions panel

ERROR: operator does not exist: text ->> unknown LINE 1: ...stomer' as customer_name,sales_info ->>'PRODUCTS' ->>'produc... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

PostgreSQL Enterprise Manager - PEM Monitoring Tools

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION