[LUNI] MySQL partial backup

Samir Faci samir at esamir.com
Mon Dec 6 00:45:01 CST 2010


Well.. you could do a shell script

its not a clean solution.. but given a list of tables....

do a sql connect, get the list of all tables in your database... then
do a full dump of all tables not in listA

get a structure dump only of listB (where listB = all tables - listA)

its manageable.. its just not as pretty as it could be.

--
Samir
PS.  Response sent close to 1 am.. so take it with a grain of salt.



On Sun, Dec 5, 2010 at 11:52 PM, Larry Garfield <larry at garfieldtech.com> wrote:
> Maybe I wasn't clear enough.  I want a structural backup only on about a half-
> dozen tables.  I want a complete dump on the rest of them.  It's just the
> cache tables and such that I see no reason to bother backing up the data for
> (but do want structure).  That's the part I'm having trouble with.
>
> On Sunday, December 05, 2010 7:41:03 pm Samir Faci wrote:
>> Hmmmm.. I've done a structure dump before.  But then I'm not sure why you'd
>> need to do a periodic structure dump.  Is your DB schema changing that
>> regularly that you'd need
>> an incremental backup of that?
>>
>> I can't remember the exact syntax.. but I presume that a
>>
>> -d, --no-data  would do what you want.
>>
>> (google confirmed my presumption)
>>
>> mysqldump --no-data -u someuser -p mydatabase
>>
>> --
>> Samir
>> PS. am I misunderstanding your question.. it seems fairly trivial to
>> do using the existing tools.
>>
>> On Sun, Dec 5, 2010 at 6:19 PM, Gene Jannece <ewjannece at gmail.com> wrote:
>> > Check out : http://sourceforge.net/projects/automysqlbackup/
>> >
>> > I use it a bunch.
>> >
>> > Gene
>> >
>> > On Dec 5, 2010, at 5:26 PM, Larry Garfield <larry at garfieldtech.com> wrote:
>> >> Hi folks.  I want to setup a backup script for a MySQL database, as such
>> >> things are generally regarded as Good.  mysqldump is the standard tool
>> >> there, but as near as I can tell there is no way to export only the
>> >> structure of certain tables.  It's all-or-nothing.  Easily half the
>> >> data in my database is active session records, logs, cache tables, and
>> >> other such volatile data that has no business being in a routine
>> >> backup, but I've yet to figure out from the mysqldump man page how to
>> >> only get the structure of those tables instead of the full data.
>> >>
>> >> Has anyone else done that?  Any links to recommend, or alternate
>> >> approaches?
>> >>
>> >> The database is of a size that I'll want to compress the backups as well
>> >> and ideally rotate them.  I don't know how do to proper rotation to
>> >> clear out old backups yet, but I figure one step at a time.  (Pointers
>> >> for that would be great, too, though.)
>> >> --
>> >> Linux Users Of Northern Illinois (Chicago) - Technical Discussion
>> >> http://luni.org/mailman/listinfo/luni
>> >
>> > --
>> > Linux Users Of Northern Illinois (Chicago) - Technical Discussion
>> > http://luni.org/mailman/listinfo/luni
> --
> Linux Users Of Northern Illinois (Chicago) - Technical Discussion
> http://luni.org/mailman/listinfo/luni
>



-- 
--
Samir Faci
*insert title*
fortune | cowsay -f /usr/share/cows/tux.cow


More information about the LUNI mailing list