Timo Neuvonen wrote:
> I guess this is more a database issue than a bacula issue, but anyway:
> 
> What is the proper way to restore the bacula catalog to mysql server, when I 
> have available the database dump file (bacula.sql) made by 
> make_catalog_backup script.
> 
> So, this has nothing to do with finding the catalog data from a tape drive 
> etc. What I'm actually trying to do, is to learn a foolproof way to restore 
> the catalog to is current state after some "trial and error"- style 
> experiments with bacula.
> 
> 
> On a system with no bacula installed, I tried this (syntax copied from a 
> restore example in the catalog backup script):
> 
>   mysql <bacula.sql
> 
> which results in an error message:
> 
>   ERROR 1046 (3D000) at line 22: No database selected
> 
> So it obviously won't be this simple?

mysql DBNAME < bacula.sql

where DBNAME is the database into which you wish to load.  You must 
create it first.  Scripts are supplied with Bacula to do this.

> 
> 
> Mys system:
> - centos-5.1
> - mysql-5.0.22
> - bacula-2.2.7
> 
> And finally, "head -n30 bacula.sql" prints this:
> 
> -- MySQL dump 10.10
> --
> -- Host: localhost    Database: bacula
> -- ------------------------------------------------------
> -- Server version       5.0.22
> 
> /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
> /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
> /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
> /*!40101 SET NAMES utf8 */;
> /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
> /*!40103 SET TIME_ZONE='+00:00' */;
> /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
> /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, 
> FOREIGN_KEY_CHECKS=0 */;
> /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
> /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
> 
> --
> -- Table structure for table `BaseFiles`
> --
> 
> DROP TABLE IF EXISTS `BaseFiles`;
> CREATE TABLE `BaseFiles` (
>   `BaseId` int(10) unsigned NOT NULL auto_increment,
>   `BaseJobId` int(10) unsigned NOT NULL,
>   `JobId` int(10) unsigned NOT NULL,
>   `FileId` int(10) unsigned NOT NULL,
>   `FileIndex` int(10) unsigned default NULL,
>   PRIMARY KEY  (`BaseId`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Looks OK.  The contents of a dump file does not [usually] contain the 
name of the database.

-- 
Dan Langille - http://www.langille.org/
BSDCan - The Technical BSD Conference: http://www.bsdcan.org/
PGCon  - The PostgreSQL Conference:    http://www.pgcon.org/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to