Solved

Auto Backup Database

Posted on 2004-09-13
8
274 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
Comment Utility
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 50 total points
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 3

Assisted Solution

by:Ghitza
Ghitza earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Then run this bat file vis task shedduler at any time you want
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

19 Experts available now in Live!

Get 1:1 Help Now