Solved

Auto Backup Database

Posted on 2004-09-13
8
275 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reconfigure Delphi Install? 2 46
TServerSocket - file via sendbuf or Text via sendtext ? 1 44
Controlled Assessment GCSE - desperate help needed 4 76
CheckListBox usage 3 51
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

862 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

24 Experts available now in Live!

Get 1:1 Help Now