From: | Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com> |
---|---|
To: | Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com> |
Cc: | pgsql-general General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Restoring 2 Tables From All Databases Backup |
Date: | 2011-10-05 14:50:56 |
Message-ID: | CAP_rwwkgUMMR6+WLgAXafKLUB20B0CxxQ+feVdMWo27jmyvZtg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2011/10/5 Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com>
> Dear all,
>
> About 1 month ago, I take a complete databases backup of my Database server
> through pg_dumpall command.
> Today I need to extract or restore only 2 tables in a database.
>
> Is it possible or I have to restore complete Databases again. Size of
> backup is 10 GB in .sql.gz format.
>
> Please let me know how to extract the tables from this 10Gb backup file
>
>
since this is a plaintext file, not a custom format backup,
you unfortunately need to extract portions of text using some editor or
program...
for this kind of work I would recommend Perl or Awk.
below is my "first shot" - thats incomplete (no restoration of
indexes/sequences):
gunzip -cd all.sql.gz | awk '/^CREATE TABLE mytable /,/^$/ { print }; /^COPY
mytable /,/^$/ { print };'
which does print all lines from CREATE TABLE mytable to next empty line, and
all lines from COPY mytable to next empty line.
From | Date | Subject | |
---|---|---|---|
Next Message | tushar nehete | 2011-10-05 15:08:46 | How to create database link and synonym in postgresql 9.0 |
Previous Message | salah jubeh | 2011-10-05 14:40:47 | Re: how to disable all pkey/fkey constraints globally |