Activities

November 2016
M T W T F S S
« Aug   Jan »
 123456
78910111213
14151617181920
21222324252627
282930  

How to pull single table data from full database backup file.

At some time, you would ask to restore a particular table from a full backup. So you have to follow the below steps.

1. Request backup team to provide the backup
2. Decompress the backup.
3. Move the file to target server.
4. Restore entire backup which take long time based of the volume.
5. Pull particular table backup and provide it to the requestee.

The below single line of bash command will help you to get single table backup which stored into a particular file. Here I’m going to pull the table backup of help_category from a database.

#sed -n -e '/DROP TABLE.*`help_category`/,/UNLOCK TABLES/p' /tmp/fullbackup.sql  > tabledump.sql

Note : Note : You may need to remember this activity will open a single file, sometime GB file which would harm the entire server resources and not advisable to execute this script on any Production server. Also you may need more CPU/RAM for this activity.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>