David Brodbeck <brodb...@math.ucsb.edu> wrote:

I've been wondering the same thing, especially since there seems to be no
official way to migrate an SQLite database to PostgreSQL or MariaDB. I'm
actually not opposed to doing using one of those (I feel like a "real"
RDBMS might offer better performance and stability in my case -- my
installation has grown to about 60 clients) but everyone who's done it
seems to have rolled their own script to do the conversion. Descriptions of
the process in the mailing list archives are pretty vague, and I'm not
confident I understand the Bacula schema well enough to pull it off safely.

I wrote my own tiny script now:

#!/bin/sh -e
date
sqlite3 /var/db/bacula/bacula.db '.dump' > sqlite.dump
echo 'SET FOREIGN_KEY_CHECKS=0;' > mysql.dump
grep INSERT sqlite.dump | grep -vE '^INSERT INTO (Status|Version)' >> mysql.dump
echo 'SET FOREIGN_KEY_CHECKS=1;' >> mysql.dump
/usr/bin/time -l mysql bacula < mysql.dump
date



Output:
root@arborio /root> sh sqlite2mysql.sh
Mon Apr 22 11:26:54 CEST 2019
mysql: Unknown OS character set 'ISO8859-15'.
mysql: Switching to the default character set 'latin1'.
    28664.84 real        40.49 user        54.83 sys
      6848  maximum resident set size
      2459  average shared memory size
       866  average unshared data size
       126  average unshared stack size
       411  page reclaims
        43  page faults
         0  swaps
        30  block input operations
         0  block output operations
   2520338  messages sent
   2520338  messages received
         0  signals received
   2520411  voluntary context switches
      3615  involuntary context switches
Mon Apr 22 19:24:55 CEST 2019
root@arborio /root> wc -l mysql.dump
 2520335 mysql.dump
root@arborio /root>


So it took nearly 8hrs to process 2,520,335 inserts. Prior to the process
the "create-table" script for MySQL provided by Bacula was executed.

Best regards,
Oliver


_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to