in reply to Cross platform database table backup/restore

Is the table prebuilt on the $dest DB? Any concerns with encoding? Differing data types? Large amounts of space?

If not, why not something as simple as:

  1. start transaction on $dest
  2. Start cursor on $source (select * from source_table)
  3. delete data on $dest (delete from backup_table)
  4. insert each row from $source to $dest (get from $source, save to $dest)
  5. end transaction on $dest

This won't be terribly fast if it is a large table. There may also be better tools for this (export to a CSV, import from CSV, for example, given the right format of the data).

Are there any special constraints on your problem that stop you from using the straightforward solution?

--MidLifeXis

  • Comment on Re: Cross platform database table backup/restore

Replies are listed 'Best First'.
Re^2: Cross platform database table backup/restore
by gwhite (Friar) on Oct 15, 2010 at 19:26 UTC

    We are giving the client the option to merge (but not add) some data into the database

    We want to take a snapshot of the table premerge, if they discover something is awry (sometimes days and several updates later) we want the premerge data. Some of our clients have 100,000+ records in each of 5-6 tables. Encoding and such isn't an issue, we just support various DB platforms, so I was hoping there was a module that let me do something like a $dbh->backup($mytable_name, $myholding_file); & a $dbh->restore($myholding_file, $mytable_name); (and yes I know if updates have been made we may need to do more, but this would be enough 75% of the time)

    g_White

      And the export/import to/from CSV or XML or SQL would work, just looking to see if there was a cross platform tool that did this amongst some of the cryptic DBIx module names....

      g_White