Please just remove all DEFAULT 0 from all DATETIME fields in the make_mysql_tables.in file.  This is the fix I added to 7.4.3 (I think).  Bacula sets (and has done so for a long time) the value to zero when it needs to.

Bottom line -- even simpler.  Search and replace:

DATETIME DEFAULT 0;

with

DATETIME;

In make_mysql_tables.in

Best regards,
Kern

On 10/03/2016 11:19 AM, Ralph Bolton wrote:
Yeah, Oracle are making changes alright - not all of them are good :-(

It's a relatively easy to fix, and actually, it's probably something that should be changed in the "make_mysql_tables" file supplied with Bacula (as it's backwards compatible with older MySQL and MariaDBs). The change is a search and replace for:

DATETIME DEFAULT 0,

...to...

DATETIME DEFAULT '0000-00-00 00:00:00',

(There is additionally some way of setting a few config variables and restarting mysql to get the old behavior, but I can't remember them off-hand)

Just by way of example, here's a "SHOW CREATE TABLE Job" on my DB:

| Job   | CREATE TABLE `Job` (
  `JobId` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Job` tinyblob NOT NULL,
  `Name` tinyblob NOT NULL,
  `Type` binary(1) NOT NULL,
  `Level` binary(1) NOT NULL,
  `ClientId` int(11) DEFAULT '0',
  `JobStatus` binary(1) NOT NULL,
  `SchedTime` datetime DEFAULT '0000-00-00 00:00:00',
  `StartTime` datetime DEFAULT '0000-00-00 00:00:00',
  `EndTime` datetime DEFAULT '0000-00-00 00:00:00',
  `RealEndTime` datetime DEFAULT '0000-00-00 00:00:00',
  `JobTDate` bigint(20) unsigned DEFAULT '0',
  `VolSessionId` int(10) unsigned DEFAULT '0',
  `VolSessionTime` int(10) unsigned DEFAULT '0',
  `JobFiles` int(10) unsigned DEFAULT '0',
  `JobBytes` bigint(20) unsigned DEFAULT '0',
  `ReadBytes` bigint(20) unsigned DEFAULT '0',
  `JobErrors` int(10) unsigned DEFAULT '0',
  `JobMissingFiles` int(10) unsigned DEFAULT '0',
  `PoolId` int(10) unsigned DEFAULT '0',
  `FileSetId` int(10) unsigned DEFAULT '0',
  `PriorJobId` int(10) unsigned DEFAULT '0',
  `PurgedFiles` tinyint(4) DEFAULT '0',
  `HasBase` tinyint(4) DEFAULT '0',
  `HasCache` tinyint(4) DEFAULT '0',
  `Reviewed` tinyint(4) DEFAULT '0',
  `Comment` blob,
  PRIMARY KEY (`JobId`),
  KEY `Name` (`Name`(128))
) ENGINE=InnoDB AUTO_INCREMENT=5076 DEFAULT CHARSET=latin1 |

Cheers,

...Ralph

On Fri, Sep 30, 2016 at 1:31 PM, Kern Sibbald <k...@sibbald.com> wrote:
On 09/30/2016 10:49 AM, Andreas Nastke wrote:
> looks to me as if this toy (mysql) finally handles invalid
> timestamps as erroneous.

Yes, MySQL now treats 0 timestamps as erroneous, which is rather simple
minded, since 0 is a perfectly valid Unix timestamp value.
>
>
>
> Daniel Heitepriem schrieb:
>> Hi guys,
>>
>> any thoughts on this ?
>>
>> Thanks and regards,
>> Daniel Heitepriem
>>
>> Am 20.09.16 um 12:01 schrieb Daniel Heitepriem:
>>
>>     Hello everyone,
>>
>>     I updated my old bacula database from version 12 (Bacula version 5.0.0)
>>     to version 15 (Bacula version 7.4.2) which went more or less without
>>     errors (see below):
>>
>>     bacula@...:~/etc$ ./update_mysql_tables -u bacula -p
>>
>>     This script will update a Bacula MySQL database from version 12-14 to 15
>>
>>     Depending on the current version of your catalog,
>>     you may have to run this script multiple times.
>>
>>     Enter password:
>>     Enter password:
>>     ERROR 1067 (42000) at line 19: Invalid default value for 'SchedTime'
>>     Update of Bacula MySQL tables from 12 to 13 succeeded.
>>     Enter password:
>>     Enter password:
>>
>>     Update of Bacula MySQL tables from 13 to 14 succeeded.
>>     Enter password:
>>     Enter password:
>>     ERROR 1067 (42000) at line 5: Invalid default value for 'FirstWritten'
>>     ERROR 1067 (42000) at line 6: Invalid default value for 'FirstWritten'
>>     ERROR 1067 (42000) at line 7: Invalid default value for 'FirstWritten'
>>     ERROR 1067 (42000) at line 8: Invalid default value for 'FirstWritten'
>>     ERROR 1067 (42000) at line 9: Invalid default value for 'FirstWritten'
>>     ERROR 1067 (42000) at line 29: Invalid default value for 'SchedTime'
>>     Update of Bacula MySQL tables from 14 to 15 succeeded.
>>     Enter password:
>>     bacula@...:~/etc$
>>
>>     After that I tried to restore a file which gave me this error in
>> bconsole:
>>     20-Sep 13:13 backup-host-dir JobId 0: Fatal error: sql_create.c:86
>>     Create DB Job record INSERT INTO Job
>>     (Job,Name,Type,Level,JobStatus,SchedTime,JobTDate,ClientId,Comment)
>>     VALUES
>>
>> ('RestoreFiles.2016-09-20_13.13.49_03','RestoreFiles','R','F','C','2016-09-20
>>
>>     13:13:43',1474370023,128,'') failed. ERR=Incorrect datetime value:
>>     '0000-00-00 00:00:00' for column 'StartTime' at row 1
>>
>>     How can I fix this?
>>     Thanks you very much.
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Bacula-users mailing list
>> Bacula-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/bacula-users



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



--

Ralph Bolton
Systems Administrator

Calltracks Ltd

Email:   ralph.bol...@calltracks.com
Web:    www.calltracks.com
Tel:      +44 20 3199 9000
Fax:     +44 20 3199 9009

High availability call monitoring, tracking and NTS services. The opinions expressed are those of the individual and not the company. Internet communications are not secure and therefore Calltracks Ltd ("the company") does not accept liability for any claims arising as a result of the use of this medium for transmissions by or to the company. This email and any files transmitted with it are confidential. If you are not the intended recipient, you are hereby notified that any disclosure, distribution or copying of this communication is strictly prohibited. Whilst we take every reasonable precaution to screen out computer viruses from emails, attachments to the email may contain such viruses. We cannot accept liability for loss or damage resulting from such viruses. Calltracks Ltd is registered in England and Wales 6539973 at Unit 15, 3rd Floor, 23-28 Penn Street, London, N1 5DL


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to