I’ve found that dropping and re-creating the target database is the cleanest way to restore a dumpfile — no stray relations left to cause trouble.
Unless you own all of the objects being restored, you may need to be SUPERUSER in order to have a successful restore.
The custom dump format is quite useful. Unlike the normal sequence of SQL statements you may be used to from mysqldump (and pg_dump as well), the –format=custom option will create a compressed archive file (internally a tar file) that can be selectivly read with pg_restore. That flexibility could come in handy if you *just* need the schema from 1 table, or *just* the data from another table.
pg_dump –format=custom -U jason_super MyDatabase > MyDatabase.pgdump
pg_restore –exit-on-error –clean –dbname=MyDatabase MyDatabase.pgdump
Get all of the SQL
pg_restore TMTManage_2.pgdump | more
Get some of the SQL
pg_restore –schema=ACRM –table=Admin TMTManage_2.pgdump | more