Solved

How to backup firebird database using IBBackupservice

Posted on 2014-03-09
17
984 Views
Last Modified: 2014-03-12
Hi, I don' know what the problem is here. I've written a program in delphi2006, using firebird database 2.5.2. What I want to do is to make a backup of the database on a remote device in my network. On the local machine no problem.
Settings of th backupservice:
- Database: D:\Databases\JAWSIE.FDB
- Protocol: TCP
- Servername: localhost
- Options: IgnoreLimbo,NoGarbageCollection,NonTransportable
- BackupFIle: \\EDMINI\LacieMario\Test.fbk

How should I do this; I also tried on another computer, no result

thx
Mario
0
Comment
Question by:marioway
  • 9
  • 8
17 Comments
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916001
you appear to be accessing the database via a local mount of a remote disk, you cannot do this for back or any other purpose.

you need to install firebird server on the real host only, get rid of the share and then do the backup

its very unusual to use NonTransportable, be sure you have a good reason
0
 

Author Comment

by:marioway
ID: 39916128
Hi Nick, Firebird is installed on local computer, on D:\Firebird, database: D:\Databases\jawsie.fbd , I would like ot make backup on the lacie network drive (networkconnection Z:)

Mario
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916161
firebird will not work on a network drive, the drive containing the database file MUST be local to the process that accesses it.
0
 

Author Comment

by:marioway
ID: 39916168
Nick, the database IS on the local computer, D:\Databases\awsie.fdb
0
 

Author Comment

by:marioway
ID: 39916175
When I put in BackupFile: D:\Databases\Test.fbk , it works
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916348
ok, I'm confused so I'll try and put my current understanding of the problem

the firebird database D:\Databases\awsie.fdb can be backedup to D:\Databases\Test.fbk but will not backup if the destination is, say, P:\Databases\Test.fbk where P is a local mount of a remote disk.

If my understanding is now correct, this should work, the backup process is just writing to a disk without any special requirements. obviously it does need windows-level permissions to write the file but thats it.
0
 

Author Comment

by:marioway
ID: 39916360
Ok Nick, so you can only write to a local disk in the local computer (let's say C or D, but not remote); I put the backupservice transportable; so when I should create fi Jawsie.fbk to D:\Databases\Backup db, make a zip file of it and copy it to the external drive, this would do the thing ? When a crash, I unzip the file and put it back on the C / drive of the local computer.
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916365
the backup should be able to be written to any disk, local or remote. The database has to be local.

Transportable is to do with the platforms that can restore it

the plan of write a backup locally then zip and/or copy it to a remote drive is ok, however firebirs is very resiliant to crashes.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:marioway
ID: 39916380
Yes nick, but I don't understand why the backupfile is not written to my external drive, however it's visible to the local pc, \\EDMINI\LacieMario
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916845
I'd look at permissions, in case the backup is not allowed to write, can you write a file to the backup area a different way (not a backup)
0
 

Author Comment

by:marioway
ID: 39921799
Hi Nick, I'm back. I 've looked on the internet a bit, and found that the IBBackupservice kan only make the backup on the local pc. That's no problem, I make the backup in the backup dir locally, then put a zip-file on the ethernet disk, this works, but there is a problem with this code:

procedure THoofdfact.JfBitBtn1Click(Sender: TObject);
var p: string;
begin
with Datamodule1 do begin
 with IBBackupService1 do begin
   Active:= True;
    try
     ServiceStart;
    finally
      Active:= False;
    end;
 end;
  if IBBackupService1.Active = False then
   begin
       with Backuptablequery do begin   //backuppad ophalen
        Close;
        Prepare;
        Open;
       end;
        p:= Trim(Backuptablequery.FieldByName('BACKUPPAD').AsString);
         with Archiver do
          begin

           Filename:= p  + '\' + 'JawsieCS.ZIP';

           // Create a new archive file
           OpenArchive(fmCreate);

           // Add all files and directories from 'C:\SOURCE_FOLDER' to the archive

           AddFiles('JawsieCS.fbk');

           // Close the archive
           CloseArchive;

          end;
   end;
end;
end;

Open in new window


I get an error that the Jawsiecs.fbk is in use while trying to make the zip-file. So the service hasn't ended yet. How can I make this work ?

thx
Mario
0
 
LVL 19

Accepted Solution

by:
NickUpson earned 500 total points
ID: 39921822
after ServiceStart of the backup you then need to wait until its complete, it can take a long time.

another alternative would be to call the firebird program gbak which will write the backup file where you want it to go
0
 

Author Comment

by:marioway
ID: 39921844
how do I call this from my Delphi app ? Shellexecute ?
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 39922120
shellexecute should work, gbak is in the firebird bin directory

"gbak -h" will give you the syntax & options
0
 

Author Comment

by:marioway
ID: 39922171
hi nick, executing from dos window

gbak -t -user SYSDBA -password "orchidee" localhost:d:/databases/jawsie.fdb \\EDMINI\LacieMario\JawsieCS.fbk  

works fine

but

 ShellExecute(Handle, 'Open', PChar('d:\Firebird\Firebird2_5\bin\gbak.exe -t -user SYSDBA -password "orchidee" localhost:d:/databases/jawsie.fdb \\EDMINI\LacieMario\JawsieCS.fbk'), '', '', SW_SHOWNORMAL);

does not work ; quid ?

mario
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 39922738
no idea, sorry
0
 

Author Comment

by:marioway
ID: 39925119
Nick, I 've got the solution

procedure THoofdfact.BackupbtnClick(Sender: TObject);
var p, q: string;
begin
 with Datamodule1 do begin
  with Backuptablequery do begin
    Close;
    Prepare;
    Open;
  end;
   p:= Trim(Backuptablequery.FieldByName('GBAKPAD').AsString) + '\gbak.exe';
   q:= '-t -l -user SYSDBA -password "orchidee" localhost:' + Trim(Backuptablequery.FieldByName('DBPAD').AsString) + '/jawsie.fdb ' + Trim(Backuptablequery.FieldByName('BACKUPPAD').AsString) + '\JawsieCS.fbk';
 end;
ShellExecute(Handle, 'Open', PChar(p), PChar(q), nil, SW_HIDE);
end;

this works perfectly

thx
Mario
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
Creating and Managing Databases with phpMyAdmin in cPanel.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now