Solved

Auto Backup Database

Posted on 2004-09-13
8
279 Views
Last Modified: 2010-04-05
How can I create a procedure to backup my database named ABC.gdb every night at 12:00, in a directory (e.g. called C:\BACKUP)?  I'm using delphi 5 & interbase 6 ...... Thanks
0
Comment
Question by:authumn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12042085
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 50 total points
ID: 12042113
you could create a little program (or service) with a timer. Than in ontimer event if time is 12.00 you could start gbak.exe (a backup/restore command prompt tool that comes with interbase) using shellexecute with your parameters....
0
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 100 total points
ID: 12042553
You don't even need to create a program to do this... Windows has build-in functionality to execute some program at a certain time.

On Windows NT you could, for example, use the AT command to start a task at a certain time.
Or you go to Settings/Control Panel/Scheduled actions and schedule an action that needs to happen every night on midnight. This could be a cimple command like "copy abc.gdb def.gdb" or even something more complicated...

However, there are no programs possible that will turn your computer ON at midnight... :-) So you need to keep the PC running 24/7...

Creating an application with a timer in it is something I would not advise. Better to use the Windows scheduler and perhaps even interact with it.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Assisted Solution

by:Ghitza
Ghitza earned 50 total points
ID: 12049610
Put 2 timers on a form.


On timer1

var
 h,m,s,ms:word;
begin
decodetime(now,h,m,s,ms);
if h>=12 then
begin
//overwrites the existing backup
copyfile('C:\yourfolder\ABC.gdb','C:\BackUp\abc.gdb',false);
Timer1.Enabled:=false;
end;
end;


On timer2
var
 h,m,s,ms:word;
begin
decodetime(now,h,m,s,ms);
if (h<12)and (h>11) then
begin
//start the first timer
Timer1.Enabled:=true;
end;
end;
0
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 100 total points
ID: 12052603
http://codecentral.borland.com/codecentral/ccweb.exe/listing?id=16007 for the Task Scheduler API headers.

The best thing about the scheduler is that whatever program you're using to make a backup, it doesn't have to run until you decide to make the backup.
0
 
LVL 9

Assisted Solution

by:tkalchev
tkalchev earned 50 total points
ID: 12073832
Do not simply copy the gdb file itself, it will only cause problems in the future. Use the gbak program, which ships with Interbase.
Create a BAT file, containing the following (cnange the username SYSDBA and the password masterkey with the correct values ) :

@echo off
gbak -backup -v -user SYSDBA -pass masterkey c:\database_path\ABC.gdb c:\backup\ABC.gbk
0
 
LVL 9

Expert Comment

by:tkalchev
ID: 12073834
Then run this bat file vis task shedduler at any time you want
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

734 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