I hate to give you a non-perl option, but....

Since you're using MySQL qhy not just use its built-in functions for dumping and loading data? In my experience built-in DB tools such as there are often significantly faster than iterating through a DB by hand for replication (typically 10x faster if not more). mysqldump does a great job of dumping a snapshot of a MySQL DB. It can be configured to dump the schemas along with the contents. mysqlimport can then be used to load the dump file back into another MySQL on another server (after you move the dump file over). At the very least, since your source DB is MySQL you can use mysqldump and load from that dump into the other DB. I've used mysqldump and mysqlimport in conjunction with dumps to/from other DB's (most DB's have similar tools) and had very good success. Both tools are very configurable to handle a variety of common methods of formatting the data. IMHO you should alway's use a DB's native import and export functions, if necessary use a perl program to translate the format if both don't use the same format.

If you are bound-and-determined to do this in perl, you are going to have trouble because there is no standard cross-db way to get a listing of all the tables and to dump their schemas.


In reply to Re: Dumping a Database via DBI by lhoward
in thread Dumping a Database via DBI by athomason

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.