Priority:
+01-Apr 00:42 rufus-dir: Start Backup JobId 55, Job=kernsave.2007-04-01_00.42.48
+01-Apr 00:42 rufus-sd: Python SD JobStart: JobId=55 Client=Rufus
+01-Apr 00:42 rufus-dir: Created new Volume "Full0001" in catalog.
+01-Apr 00:42 rufus-dir: Using Device "File"
+01-Apr 00:42 rufus-sd: kernsave.2007-04-01_00.42.48 Warning: Device "File" (/tmp) not configured to autolabel Volumes.
+01-Apr 00:42 rufus-sd: kernsave.2007-04-01_00.42.48 Warning: Device "File" (/tmp) not configured to autolabel Volumes.
+01-Apr 00:42 rufus-sd: Please mount Volume "Full0001" on Storage Device "File" (/tmp) for Job kernsave.2007-04-01_00.42.48
+01-Apr 00:44 rufus-sd: Wrote label to prelabeled Volume "Full0001" on device "File" (/tmp)
+
- Add Where: client:/.... to restore job report.
- Ensure that each device in an Autochanger has a different
Device Index.
if (mdb->db == NULL) {
Mmsg2(&mdb->errmsg, _("Unable to connect to MySQL server.\n"
"Database=%s User=%s\n"
-"It MySQL server not running or your password is incorrect.\n"),
+"MySQL connect failed either server not running or your authorization is incorrect.\n"),
mdb->db_name, mdb->db_user);
V(mutex);
return 0;
// bmicrosleep(15, 0); /* for debugging SIGHUP */
- Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s) %s %s %s at %s\n"
+ Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n"
+" Build OS: %s %s %s\n"
" JobId: %d\n"
" Job: %s\n"
" Backup Level: %s%s\n"
" FD termination status: %s\n"
" SD termination status: %s\n"
" Termination: %s\n\n"),
- my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER,
- edt,
+ my_name, VERSION, LSMDATE, edt,
+ HOST_OS, DISTNAME, DISTVER,
jcr->jr.JobId,
jcr->jr.Job,
level_to_str(jcr->JobLevel), jcr->since,
Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
}
+ drop(uid, gid); /* reduce privileges if requested */
+
+ if (!check_catalog()) {
+ Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
+ }
+
if (test_config) {
terminate_dird(0);
}
create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
- drop(uid, gid); /* reduce privileges if requested */
-
- if (!check_catalog()) {
- Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
- }
#if !defined(HAVE_WIN32)
signal(SIGHUP, reload_config);
catalog->db_port, catalog->db_socket,
catalog->mult_db_connections);
if (!db || !db_open_database(NULL, db)) {
+ Pmsg2(000, _("Could not open Catalog \"%s\", database \"%s\".\n"),
+ catalog->name(), catalog->db_name);
Jmsg(NULL, M_FATAL, 0, _("Could not open Catalog \"%s\", database \"%s\".\n"),
catalog->name(), catalog->db_name);
if (db) {
Jmsg(NULL, M_FATAL, 0, _("%s"), db_strerror(db));
+ Pmsg1(000, "%s", db_strerror(db));
}
OK = false;
continue;
jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
- Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s) %s %s %s at %s\n"
+ Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n"
+" Build OS: %s %s %s\n"
" Prev Backup JobId: %s\n"
" New Backup JobId: %s\n"
" Migration JobId: %s\n"
" SD Errors: %d\n"
" SD termination status: %s\n"
" Termination: %s\n\n"),
- my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER,
- edt,
+ my_name, VERSION, LSMDATE, edt,
+ HOST_OS, DISTNAME, DISTVER,
edit_uint64(jcr->previous_jr.JobId, ec6),
mig_jcr ? edit_uint64(mig_jcr->jr.JobId, ec7) : "0",
edit_uint64(jcr->jr.JobId, ec8),
jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg));
jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
- Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s) %s %s %s at %s\n"
+ Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n"
+" Build OS: %s %s %s\n"
" JobId: %d\n"
" Job: %s\n"
" Client: %s\n"
" FD termination status: %s\n"
" SD termination status: %s\n"
" Termination: %s\n\n"),
- my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER,
- edt,
+ my_name, VERSION, LSMDATE, edt,
+ HOST_OS, DISTNAME, DISTVER,
jcr->jr.JobId,
jcr->jr.Job,
jcr->client->hdr.name,
jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg));
if (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) {
jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
- Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s) %s %s %s at %s\n"
+ Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n"
+" Build OS: %s %s %s\n"
" JobId: %d\n"
" Job: %s\n"
" FileSet: %s\n"
" FD termination status: %s\n"
" SD termination status: %s\n"
" Termination: %s\n\n"),
- my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER,
- edt,
+ my_name, VERSION, LSMDATE, edt,
+ HOST_OS, DISTNAME, DISTVER,
jcr->jr.JobId,
jcr->jr.Job,
jcr->fileset->hdr.name,
sd_term_msg,
term_msg);
} else {
- Jmsg(jcr, msg_type, 0, _("Bacula %s Version: %s (%s) %s %s %s\n"
+ Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n"
+" Build: %s %s %s\n"
" JobId: %d\n"
" Job: %s\n"
" FileSet: %s\n"
" Non-fatal FD errors: %d\n"
" FD termination status: %s\n"
" Termination: %s\n\n"),
- my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER,
+ my_name, VERSION, BDATE, edt,
+ HOST_OS, DISTNAME, DISTVER,
edt,
jcr->jr.JobId,
jcr->jr.Job,
Technical notes on version 2.1
General:
+01Apr07
+kes Modify job report to include director name and Build OS.
+kes Move drop and check_catalog() before fork.
+kes Add update database scripts (version 9 to 10) to updatedb directory.
31Mar07
-ebl Check size and age of each file after their backup to see if
- they have changed during backup.
- It ask to fd to do an extra check (stat(2)) after
+ebl Check size and age of each file after its backup to see if
+ it has changed during backup, if "checkfilechanges" is set.
+ The FD will do an extra check (stat(2)) after
each file backup. mtime, ctime and size are compared with
- "before backup" informations. If time or size mismatch, an
- error will raise.
- You must upgrade FD to use it.
+ 'before backup' information. If time or size mismatch, an
+ error message will be generated. You must upgrade FD to use it.
30Mar07
kes Make database name and user configurable
--with-db-name=xxx --with-db-user=xxx
--- /dev/null
+#!/bin/sh
+#
+# Shell script to update bdb tables
+# Nothing to do here.
+#
+echo " "
+bindir=/home/kern/bacula/depkgs/sqlite
+
+exit 0
--- /dev/null
+#!/bin/sh
+#
+# Shell script to update MySQL tables from version 1.38 to 2.0
+#
+echo " "
+echo "This script will update a Bacula MySQL database from version 9 to 10"
+echo " which is needed to convert from Bacula version 1.38.x to 2.0.x or higher"
+echo "Depending on the size of your database,"
+echo "this script may take several minutes to run."
+echo " "
+bindir=/home/kern/bacula/depkgs/sqlite
+
+if $bindir/mysql $* -f <<END-OF-DATA
+USE bacula;
+
+DROP TABLE IF EXISTS MAC;
+DROP TABLE IF EXISTS Log;
+DROP TABLE IF EXISTS Location;
+DROP TABLE IF EXISTS LocationLog;
+
+CREATE TABLE Log (
+ LogId INTEGER UNSIGNED AUTO_INCREMENT,
+ JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,
+ Time DATETIME DEFAULT 0,
+ LogText BLOB NOT NULL,
+ PRIMARY KEY(LogId),
+ INDEX (JobId)
+ );
+
+CREATE TABLE Location (
+ LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ Location TINYBLOB NOT NULL,
+ Cost INTEGER DEFAULT 0,
+ Enabled TINYINT,
+ PRIMARY KEY(LocationId)
+ );
+
+CREATE TABLE LocationLog (
+ LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ Date DATETIME DEFAULT 0,
+ Comment BLOB,
+ MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media,
+ LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,
+ NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',
+ 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,
+ NewEnabled TINYINT,
+ PRIMARY KEY(LocLogId)
+);
+
+ALTER TABLE Media ADD COLUMN MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType;
+ALTER TABLE Media ADD COLUMN DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device;
+ALTER TABLE Media ADD COLUMN LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location;
+ALTER TABLE Media ADD COLUMN RecycleCount INTEGER UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN InitialWrite DATETIME DEFAULT 0;
+ALTER TABLE Media ADD COLUMN ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;
+ALTER TABLE Media ADD COLUMN RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;
+ALTER TABLE Media ADD COLUMN Enabled TINYINT DEFAULT 1;
+ALTER TABLE Media ADD COLUMN Comment BLOB;
+
+ALTER TABLE JobMedia DROP COLUMN Stripe;
+
+ALTER TABLE Job ADD COLUMN PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job;
+ALTER TABLE Job ADD COLUMN RealEndTime DATETIME DEFAULT 0;
+
+
+
+DELETE FROM Version;
+INSERT INTO Version (VersionId) VALUES (10);
+
+END-OF-DATA
+then
+ echo "Update of Bacula MySQL tables succeeded."
+else
+ echo "Update of Bacula MySQL tables failed."
+fi
+exit 0
--- /dev/null
+#!/bin/sh
+#
+# Shell script to update PostgreSQL tables from version 1.38 to 2.0.0 or higher
+#
+echo " "
+echo "This script will update a Bacula PostgreSQL database from version 9 to 10"
+echo " which is needed to convert from Bacula version 1.38.x to 2.0.0 or higher"
+echo "Depending on the size of your database,"
+echo "this script may take several minutes to run."
+echo " "
+bindir=/home/kern/bacula/depkgs/sqlite
+
+if $bindir/psql -f - -d bacula $* <<END-OF-DATA
+
+ALTER TABLE media ADD COLUMN DeviceId integer;
+UPDATE media SET DeviceId=0;
+ALTER TABLE media ADD COLUMN MediaTypeId integer;
+UPDATE media SET MediaTypeId=0;
+ALTER TABLE media ADD COLUMN LocationId integer;
+UPDATE media SET LocationId=0;
+ALTER TABLE media ADD COLUMN RecycleCount integer;
+UPDATE media SET RecycleCount=0;
+ALTER TABLE media ADD COLUMN InitialWrite timestamp without time zone;
+ALTER TABLE media ADD COLUMN scratchpoolid integer;
+UPDATE media SET scratchpoolid=0;
+ALTER TABLE media ADD COLUMN recyclepoolid integer;
+UPDATE media SET recyclepoolid=0;
+ALTER TABLE media ADD COLUMN enabled integer;
+UPDATE media SET enabled=1;
+ALTER TABLE media ADD COLUMN Comment TEXT;
+
+ALTER TABLE job ADD COLUMN RealEndTime timestamp without time zone;
+ALTER TABLE job ADD COLUMN PriorJobId integer;
+UPDATE job SET PriorJobId=0;
+
+ALTER TABLE jobmedia DROP COLUMN Stripe;
+
+CREATE TABLE Location (
+ LocationId SERIAL NOT NULL,
+ Location TEXT NOT NULL,
+ Cost integer default 0,
+ Enabled integer,
+ PRIMARY KEY (LocationId)
+);
+
+CREATE TABLE LocationLog (
+ LocLogId SERIAL NOT NULL,
+ Date timestamp without time zone,
+ Comment TEXT NOT NULL,
+ MediaId INTEGER DEFAULT 0,
+ LocationId INTEGER DEFAULT 0,
+ newvolstatus text not null
+ check (newvolstatus in ('Full','Archive','Append',
+ 'Recycle','Purged','Read-Only','Disabled',
+ 'Error','Busy','Used','Cleaning','Scratch')),
+ newenabled smallint,
+ PRIMARY KEY(LocLogId)
+);
+
+
+CREATE TABLE Log
+(
+ LogId serial not null,
+ JobId integer not null,
+ Time timestamp without time zone,
+ LogText text not null,
+ primary key (LogId)
+);
+create index log_name_idx on Log (JobId);
+
+
+DELETE FROM version;
+INSERT INTO version (versionId) VALUES (10);
+
+vacuum;
+
+END-OF-DATA
+then
+ echo "Update of Bacula PostgreSQL tables succeeded."
+else
+ echo "Update of Bacula PostgreSQL tables failed."
+fi
+exit 0
--- /dev/null
+#!/bin/sh
+#
+# shell script to update SQLite from version 1.38 to 2.0
+#
+echo " "
+echo "This script will update a Bacula SQLite database from version 9 to 10"
+echo " which is needed to convert from Bacula version 1.38.x to 2.0.x or higher"
+echo "Depending on the size of your database,"
+echo "this script may take several minutes to run."
+echo " "
+
+bindir=/home/kern/bacula/depkgs/sqlite
+cd /home/kern/bacula/working
+sqlite=sqlite
+
+${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+BEGIN TRANSACTION;
+
+CREATE TEMPORARY TABLE Media_backup (
+ MediaId INTEGER UNSIGNED AUTOINCREMENT,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ MediaType VARCHAR(128) NOT NULL,
+ MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0,
+ LabelType TINYINT DEFAULT 0,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolParts INTEGER UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ StorageId INTEGER UNSIGNED REFERENCES Storage,
+ DeviceId INTEGER UNSIGNED REFERENCES Device,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ LocationId INTEGER UNSIGNED REFERENCES Location,
+ RecycleCount INTEGER UNSIGNED DEFAULT 0,
+ InitialWrite DATETIME DEFAULT 0,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ PRIMARY KEY(MediaId)
+ );
+
+INSERT INTO Media_backup SELECT
+ MediaId, VolumeName, Slot, PoolId,
+ MediaType, LabelType, 0, FirstWritten, LastWritten,
+ LabelDate, VolJobs, VolFiles, VolBlocks,
+ VolMounts, VolBytes, VolParts, VolErrors, VolWrites,
+ VolCapacityBytes, VolStatus, 1, Recycle,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes, InChanger,
+ StorageId, 0, MediaAddressing,
+ VolReadTime, VolWriteTime, EndFile, EndBlock, 0, 0, 0, 0, 0
+ FROM Media;
+
+
+DROP TABLE Media;
+
+CREATE TABLE Media (
+ MediaId INTEGER,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ MediaType VARCHAR(128) NOT NULL,
+ MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0,
+ LabelType TINYINT DEFAULT 0,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolParts INTEGER UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ StorageId INTEGER UNSIGNED REFERENCES Storage DEFAULT 0,
+ DeviceId INTEGER UNSIGNED REFERENCES Device DEFAULT 0,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ LocationId INTEGER UNSIGNED REFERENCES Location DEFAULT 0,
+ RecycleCount INTEGER UNSIGNED DEFAULT 0,
+ InitialWrite DATETIME DEFAULT 0,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ Comment TEXT,
+ PRIMARY KEY(MediaId)
+ );
+
+INSERT INTO Media (
+ MediaId, VolumeName, Slot, PoolId,
+ MediaType, MediaTypeId, LabelType, FirstWritten, LastWritten,
+ LabelDate, VolJobs, VolFiles, VolBlocks,
+ VolMounts, VolBytes, VolParts, VolErrors, VolWrites,
+ VolCapacityBytes, VolStatus, Enabled, Recycle,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes,
+ InChanger, StorageId, DeviceId, MediaAddressing,
+ VolReadTime, VolWriteTime,
+ EndFile, EndBlock, LocationId, RecycleCount, InitialWrite,
+ ScratchPoolId, RecyclePoolId)
+ SELECT * FROM Media_backup;
+
+
+DROP TABLE Media_backup;
+CREATE INDEX inx8 ON Media (PoolId);
+
+CREATE TEMPORARY TABLE job_backup
+(
+ JobId INTEGER,
+ Job VARCHAR(128) NOT NULL,
+ Name VARCHAR(128) NOT NULL,
+ Type CHAR NOT NULL,
+ Level CHAR NOT NULL,
+ ClientId INTEGER REFERENCES Client DEFAULT 0,
+ JobStatus CHAR NOT NULL,
+ SchedTime DATETIME NOT NULL,
+ StartTime DATETIME DEFAULT 0,
+ EndTime DATETIME DEFAULT 0,
+ RealEndTime DATETIME DEFAULT 0,
+ JobTDate BIGINT UNSIGNED DEFAULT 0,
+ VolSessionId INTEGER UNSIGNED DEFAULT 0,
+ VolSessionTime INTEGER UNSIGNED DEFAULT 0,
+ JobFiles INTEGER UNSIGNED DEFAULT 0,
+ JobBytes BIGINT UNSIGNED DEFAULT 0,
+ JobErrors INTEGER UNSIGNED DEFAULT 0,
+ JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ FileSetId INTEGER UNSIGNED REFERENCES FileSet DEFAULT 0,
+ PriorJobId INTEGER UNSIGNED REFERENCES Job DEFAULT 0,
+ PurgedFiles TINYINT DEFAULT 0,
+ HasBase TINYINT DEFAULT 0
+ );
+
+INSERT INTO Job_backup SELECT
+ JobId, Job, Name, Type, Level, ClientId, JobStatus,
+ SchedTime, StartTime, EndTime, 0,
+ JobTDate, VolSessionId, VolSessionTime,
+ JobFiles, JobBytes, JobErrors, JobMissingFiles,
+ PoolId, FileSetId, 0, PurgedFiles, HasBase
+ FROM Job;
+
+DROP TABLE Job;
+
+CREATE TABLE Job
+(
+ JobId INTEGER,
+ Job VARCHAR(128) NOT NULL,
+ Name VARCHAR(128) NOT NULL,
+ Type CHAR NOT NULL,
+ Level CHAR NOT NULL,
+ ClientId INTEGER REFERENCES Client DEFAULT 0,
+ JobStatus CHAR NOT NULL,
+ SchedTime DATETIME NOT NULL,
+ StartTime DATETIME DEFAULT 0,
+ EndTime DATETIME DEFAULT 0,
+ RealEndTime DATETIME DEFAULT 0,
+ JobTDate BIGINT UNSIGNED DEFAULT 0,
+ VolSessionId INTEGER UNSIGNED DEFAULT 0,
+ VolSessionTime INTEGER UNSIGNED DEFAULT 0,
+ JobFiles INTEGER UNSIGNED DEFAULT 0,
+ JobBytes BIGINT UNSIGNED DEFAULT 0,
+ JobErrors INTEGER UNSIGNED DEFAULT 0,
+ JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ FileSetId INTEGER UNSIGNED REFERENCES FileSet DEFAULT 0,
+ PriorJobId INTEGER UNSIGNED REFERENCES Job DEFAULT 0,
+ PurgedFiles TINYINT DEFAULT 0,
+ HasBase TINYINT DEFAULT 0,
+ PRIMARY KEY(JobId)
+ );
+CREATE INDEX inx6 ON Job (Name);
+
+INSERT INTO Job (
+ JobId, Job, Name, Type, Level, ClientId, JobStatus,
+ SchedTime, StartTime, EndTime, RealEndTime,
+ JobTDate, VolSessionId, VolSessionTime,
+ JobFiles, JobBytes, JobErrors, JobMissingFiles,
+ PoolId, FileSetId, PriorJobId, PurgedFiles, HasBase)
+ SELECT * FROM Job_backup;
+
+DROP TABLE Job_backup;
+
+CREATE TABLE LocationLog (
+ LocLogId INTEGER,
+ Date DATETIME NOT NULL,
+ Comment TEXT NOT NULL,
+ MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0,
+ LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0,
+ NewVolStatus VARCHAR(20) NOT NULL,
+ NewEnabled TINYINT NOT NULL,
+ PRIMARY KEY(LocLogId)
+);
+
+CREATE TABLE Log (
+ LogId INTEGER,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ Time DATETIME NOT NULL,
+ LogText TEXT NOT NULL,
+ PRIMARY KEY(LogId)
+ );
+CREATE INDEX LogInx1 ON File (JobId);
+
+CREATE TABLE Location (
+ LocationId INTEGER,
+ Location TEXT NOT NULL,
+ Cost INTEGER DEFAULT 0,
+ Enabled TINYINT,
+ PRIMARY KEY(LocationId)
+ );
+
+
+DELETE FROM Version;
+INSERT INTO Version (VersionId) VALUES (10);
+
+COMMIT;
+
+END-OF-DATA
--- /dev/null
+#!/bin/sh
+#
+# shell script to update SQLite from version 1.38 to 2.0
+#
+echo " "
+echo "This script will update a Bacula SQLite database from version 9 to 10"
+echo " which is needed to convert from Bacula version 1.38.x to 2.0.x or higher"
+echo "Depending on the size of your database,"
+echo "this script may take several minutes to run."
+echo " "
+
+bindir=/home/kern/bacula/depkgs/sqlite
+cd /home/kern/bacula/working
+sqlite=sqlite
+
+${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+BEGIN TRANSACTION;
+
+CREATE TEMPORARY TABLE Media_backup (
+ MediaId INTEGER UNSIGNED AUTOINCREMENT,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ MediaType VARCHAR(128) NOT NULL,
+ MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0,
+ LabelType TINYINT DEFAULT 0,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolParts INTEGER UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ StorageId INTEGER UNSIGNED REFERENCES Storage,
+ DeviceId INTEGER UNSIGNED REFERENCES Device,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ LocationId INTEGER UNSIGNED REFERENCES Location,
+ RecycleCount INTEGER UNSIGNED DEFAULT 0,
+ InitialWrite DATETIME DEFAULT 0,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ PRIMARY KEY(MediaId)
+ );
+
+INSERT INTO Media_backup SELECT
+ MediaId, VolumeName, Slot, PoolId,
+ MediaType, LabelType, 0, FirstWritten, LastWritten,
+ LabelDate, VolJobs, VolFiles, VolBlocks,
+ VolMounts, VolBytes, VolParts, VolErrors, VolWrites,
+ VolCapacityBytes, VolStatus, 1, Recycle,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes, InChanger,
+ StorageId, 0, MediaAddressing,
+ VolReadTime, VolWriteTime, EndFile, EndBlock, 0, 0, 0, 0, 0
+ FROM Media;
+
+
+DROP TABLE Media;
+
+CREATE TABLE Media (
+ MediaId INTEGER,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ MediaType VARCHAR(128) NOT NULL,
+ MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0,
+ LabelType TINYINT DEFAULT 0,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolParts INTEGER UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ StorageId INTEGER UNSIGNED REFERENCES Storage DEFAULT 0,
+ DeviceId INTEGER UNSIGNED REFERENCES Device DEFAULT 0,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ LocationId INTEGER UNSIGNED REFERENCES Location DEFAULT 0,
+ RecycleCount INTEGER UNSIGNED DEFAULT 0,
+ InitialWrite DATETIME DEFAULT 0,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ Comment TEXT,
+ PRIMARY KEY(MediaId)
+ );
+
+INSERT INTO Media (
+ MediaId, VolumeName, Slot, PoolId,
+ MediaType, MediaTypeId, LabelType, FirstWritten, LastWritten,
+ LabelDate, VolJobs, VolFiles, VolBlocks,
+ VolMounts, VolBytes, VolParts, VolErrors, VolWrites,
+ VolCapacityBytes, VolStatus, Enabled, Recycle,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes,
+ InChanger, StorageId, DeviceId, MediaAddressing,
+ VolReadTime, VolWriteTime,
+ EndFile, EndBlock, LocationId, RecycleCount, InitialWrite,
+ ScratchPoolId, RecyclePoolId)
+ SELECT * FROM Media_backup;
+
+
+DROP TABLE Media_backup;
+CREATE INDEX inx8 ON Media (PoolId);
+
+CREATE TEMPORARY TABLE job_backup
+(
+ JobId INTEGER,
+ Job VARCHAR(128) NOT NULL,
+ Name VARCHAR(128) NOT NULL,
+ Type CHAR NOT NULL,
+ Level CHAR NOT NULL,
+ ClientId INTEGER REFERENCES Client DEFAULT 0,
+ JobStatus CHAR NOT NULL,
+ SchedTime DATETIME NOT NULL,
+ StartTime DATETIME DEFAULT 0,
+ EndTime DATETIME DEFAULT 0,
+ RealEndTime DATETIME DEFAULT 0,
+ JobTDate BIGINT UNSIGNED DEFAULT 0,
+ VolSessionId INTEGER UNSIGNED DEFAULT 0,
+ VolSessionTime INTEGER UNSIGNED DEFAULT 0,
+ JobFiles INTEGER UNSIGNED DEFAULT 0,
+ JobBytes BIGINT UNSIGNED DEFAULT 0,
+ JobErrors INTEGER UNSIGNED DEFAULT 0,
+ JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ FileSetId INTEGER UNSIGNED REFERENCES FileSet DEFAULT 0,
+ PriorJobId INTEGER UNSIGNED REFERENCES Job DEFAULT 0,
+ PurgedFiles TINYINT DEFAULT 0,
+ HasBase TINYINT DEFAULT 0
+ );
+
+INSERT INTO Job_backup SELECT
+ JobId, Job, Name, Type, Level, ClientId, JobStatus,
+ SchedTime, StartTime, EndTime, 0,
+ JobTDate, VolSessionId, VolSessionTime,
+ JobFiles, JobBytes, JobErrors, JobMissingFiles,
+ PoolId, FileSetId, 0, PurgedFiles, HasBase
+ FROM Job;
+
+DROP TABLE Job;
+
+CREATE TABLE Job
+(
+ JobId INTEGER,
+ Job VARCHAR(128) NOT NULL,
+ Name VARCHAR(128) NOT NULL,
+ Type CHAR NOT NULL,
+ Level CHAR NOT NULL,
+ ClientId INTEGER REFERENCES Client DEFAULT 0,
+ JobStatus CHAR NOT NULL,
+ SchedTime DATETIME NOT NULL,
+ StartTime DATETIME DEFAULT 0,
+ EndTime DATETIME DEFAULT 0,
+ RealEndTime DATETIME DEFAULT 0,
+ JobTDate BIGINT UNSIGNED DEFAULT 0,
+ VolSessionId INTEGER UNSIGNED DEFAULT 0,
+ VolSessionTime INTEGER UNSIGNED DEFAULT 0,
+ JobFiles INTEGER UNSIGNED DEFAULT 0,
+ JobBytes BIGINT UNSIGNED DEFAULT 0,
+ JobErrors INTEGER UNSIGNED DEFAULT 0,
+ JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ FileSetId INTEGER UNSIGNED REFERENCES FileSet DEFAULT 0,
+ PriorJobId INTEGER UNSIGNED REFERENCES Job DEFAULT 0,
+ PurgedFiles TINYINT DEFAULT 0,
+ HasBase TINYINT DEFAULT 0,
+ PRIMARY KEY(JobId)
+ );
+CREATE INDEX inx6 ON Job (Name);
+
+INSERT INTO Job (
+ JobId, Job, Name, Type, Level, ClientId, JobStatus,
+ SchedTime, StartTime, EndTime, RealEndTime,
+ JobTDate, VolSessionId, VolSessionTime,
+ JobFiles, JobBytes, JobErrors, JobMissingFiles,
+ PoolId, FileSetId, PriorJobId, PurgedFiles, HasBase)
+ SELECT * FROM Job_backup;
+
+DROP TABLE Job_backup;
+
+CREATE TABLE LocationLog (
+ LocLogId INTEGER,
+ Date DATETIME NOT NULL,
+ Comment TEXT NOT NULL,
+ MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0,
+ LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0,
+ NewVolStatus VARCHAR(20) NOT NULL,
+ NewEnabled TINYINT NOT NULL,
+ PRIMARY KEY(LocLogId)
+);
+
+CREATE TABLE Log (
+ LogId INTEGER,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ Time DATETIME NOT NULL,
+ LogText TEXT NOT NULL,
+ PRIMARY KEY(LogId)
+ );
+CREATE INDEX LogInx1 ON File (JobId);
+
+CREATE TABLE Location (
+ LocationId INTEGER,
+ Location TEXT NOT NULL,
+ Cost INTEGER DEFAULT 0,
+ Enabled TINYINT,
+ PRIMARY KEY(LocationId)
+ );
+
+
+DELETE FROM Version;
+INSERT INTO Version (VersionId) VALUES (10);
+
+COMMIT;
+
+END-OF-DATA