Solved

Auto Backup Database

Posted on 2004-09-13
8
276 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
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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

772 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