\elink{http://dev.mysql.com/doc/refman/5.0/en/gone-away.html}
{http://dev.mysql.com/doc/refman/5.0/en/gone-away.html}
+\section{MySQL Temporary Tables}
+When doing backups with large numbers of files, MySQL creates some
+temporary tables. When these tables are small they can be held in
+system memory, but as they approach some size, they
+spool off to disk. The default location for these temp tables is
+/tmp. Once that space fills up, Bacula daemons such as the Storage
+daemon doing spooling can get strange errors. E.g.
+
+\footnotesize
+\begin{verbatim}
+Fatal error: spool.c:402 Spool data read error.
+Fatal error: backup.c:892 Network send error to SD. ERR=Connection reset by
+peer
+\end{verbatim}
+\normalsize
+
+What you need to do is setup MySQL to use a different (larger) temp
+directory, which can be set in the /etc/my.cnf with these variables
+set:
+
+\footnotesize
+\begin{verbatim}
+ tmpdir=/path/to/larger/tmpdir
+ bdb_tmpdir=/path/to/larger/tmpdir
+\end{verbatim}
+\normalsize
\label{RepairingPSQL}
\section{Repairing Your PostgreSQL Database}
\begin{verbatim}
mysql bacula
CREATE INDEX file_jobid_idx on File (JobId);
-CREATE INDEX file_jpf_idx on File (Job, FilenameId, PathId);
+CREATE INDEX file_jpf_idx on File (JobId, FilenameId, PathId);
\end{verbatim}
\normalsize
\footnotesize
\begin{verbatim}
-sqlite <path>bacula.db
+sqlite <path>/bacula.db
select * from sqlite_master where type='index' and tbl_name='File';
\end{verbatim}
\normalsize
\footnotesize
\begin{verbatim}
-mysql bacula
+sqlite <path>/bacula.db
CREATE INDEX file_jobid_idx on File (JobId);
-CREATE INDEX file_jfp_idx on File (Job, FilenameId, PathId);
+CREATE INDEX file_jfp_idx on File (JobId, FilenameId, PathId);
\end{verbatim}
\normalsize
completely delete (rm) the old database before creating a new compressed
version.
-\section{Migrating from SQLite to MySQL}
+\section{Migrating from SQLite to MySQL or PostgreSQL}
\index[general]{MySQL!Migrating from SQLite to }
-\index[general]{Migrating from SQLite to MySQL }
+\index[general]{Migrating from SQLite to MySQL or PostgreSQL}
You may begin using Bacula with SQLite then later find that you want to switch
-to MySQL for any of a number of reasons: SQLite tends to use more disk than
-MySQL; when the database is corrupted it is often more catastrophic than
-with MySQL or PostgreSQL.
-Several users have succeeded in converting from SQLite to MySQL by
-exporting the MySQL data and then processing it with Perl scripts
-prior to putting it into MySQL. This is, however, not a simple
-process.
+to MySQL or Postgres for any of a number of reasons: SQLite tends to use more
+disk than MySQL; when the database is corrupted it is often more catastrophic
+than with MySQL or PostgreSQL. Several users have succeeded in converting by
+exporting the SQLite data and then processing it with Perl scripts prior to
+putting it into MySQL or PostgreSQL. This is, however, not a simple process.
+Scripts are available on bacula source distribution under
+\texttt{examples/database}.
\label{BackingUpBacula}
\section{Backing Up Your Bacula Database}