Postgres backup

データベース毎にバックアップファイルを分ける

Postgres バックアップスクリプト version 1.1
http://sonic64.com/2003-04-17.html

# Get all DB name
TARGET_DB=`psql -l -P format=unaligned -P fieldsep=, -P tuples_only |perl -F, -lane "if (@F[0] ne 'template0') {print @F[0]}"`

# Get all DB name
TARGET_DB=`psql  -P format=unaligned -P tuples_only -c "SELECT datname FROM pg_database WHERE datname NOT IN('template0','template1');"`

にする。