-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dan Langille wrote:
> 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.
Another thing to be aware of -- mysqldump has options that you can use
to A) include a statement of which database to use B) drop the
database/tables involved first, C) create the table structure required
to support the load from the dump. You'll have to see what options
make_catalog_backup uses, and whether you want it to use any that it is
not currently using.
>> 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.
>
- --
---- _ _ _ _ ___ _ _ _
|Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Systems Programmer II
|$&| |__| | | |__/ | \| _| |[EMAIL PROTECTED] - 973/972.0922 (2-0922)
\__/ Univ. of Med. and Dent.|IST/AST - NJMS Medical Science Bldg - C630
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHkRDTmb+gadEcsb4RAlxoAJ9QaKLqO0oN4I7MUEL2+iHvzvGxDACeIRCv
Ct1pwgM9y7FM7FDkfO+3Kho=
=ZrVa
-----END PGP SIGNATURE-----
begin:vcard
fn:Ryan Novosielski
n:Novosielski;Ryan
org:UMDNJ;IST/AST
adr;dom:MSB C630;;185 South Orange Avenue;Newark;NJ;07103
email;internet:[EMAIL PROTECTED]
title:Systems Programmer III
tel;work:(973) 972-0922
tel;fax:(973) 972-7412
tel;pager:(866) 20-UMDNJ
x-mozilla-html:FALSE
version:2.1
end:vcard
-------------------------------------------------------------------------
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