I need to extract the dump of a single table

written by Admin


Posted on 2012-11-26


Problem

I have a complete dump of a big database. It is too big to be opened.
How to extract the dump of a single table and restore only that part of the db?

Solution

To extract the dump o a single table from a big dump type:
$ awk '/Table structure for table .table./,/Table structure for table .next-table./{print}' full-dump.sql > extracted-table.sql

To extract the dump of a single database from a multi-database dump type:
$ awk '/Database: db-name/,/Database: next-db-name/{print}' full-dump.sql > extracted-db.sql

Feedback


Comments

Leave a Comment:

Search

Welcome

We need collaboration and a real boost from our community: write us an email for every trick you find!

This website is a sysadmin swiss-knife for every-day Windows, Linux and Mac administration and troubleshooting

Our database grows if YOU send us your tips and trick as soon as you find them every day!