O'Reilly logo

PostgreSQL 9 Administration Cookbook by Hannu Krosing, Simon Riggs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recovery of a dropped/damaged tablespace

Recovering a complete tablespace is also sometimes required. It's actually a lot easier than recovering a single table.

How to do it...

The methods differ depending upon the type of backup you have available. If you have multiple types of backup, you have a choice.

LOGICAL (from custom dump -F c):

If you've taken a logical backup using pg_dump into a custom file, then you can simply extract the tables you want from the dumpfile, like the following:

pg_restore -t mytab1 -t mytab2 … dumpfile | psql

or connect direct to the database using d.

Of course, you may have difficulty remembering which exact tables were there. So, you may need to proceed, like the following:

  • Find a suitable server, or create a new virtual ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required