Skip to content

Instantly share code, notes, and snippets.

@ebridges
Created October 21, 2014 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebridges/0e83aa7e5a07d3abd895 to your computer and use it in GitHub Desktop.
Save ebridges/0e83aa7e5a07d3abd895 to your computer and use it in GitHub Desktop.
Restores a single table from a dump file to the configured database.
#!/bin/bash
table=$1
if [ -z "$table" ];
then
echo "Usage: $0 [table-name]"
exit
fi
jdbcPort=
jdbcDatabase=
jdbcHost=
jdbcUser=
jdbcPassword=
pg_restore --dbname=${jdbcDatabase} \
--host=${jdbcHost} \
--username=${jdbcUser} \
--password \
--port=${jdbcPort} \
--single-transaction \
--no-owner \
--verbose \
-L \
dump.list dump.dmp.orig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment