I have a 15GB sql file which is a backup of a database. The problem I have is that half way through it, it failed. Luckily, I know which table to pick up from.
Is there a way I can split this SQL file by the starting point of the table I need to pick up from or perhaps get mysql to do this itself?
Thanks
You could use
sed
to split the file using rangesThis will start printing when
/Start Text/
is found and will continue printing until/End Text/
or end of file is reached. Make sureStart Text
is unique to the starting point andEnd Text
isn't in the file.You can use the
split
command (look into the line count option), or you can usedd
with a byte offset (found usinggrep -b
) to extract from your dumpfile as well.Here's a blog post that covers that process (this is an answer I gave elsewhere on the site and decided to blog the solution).