Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Auto Backup Database

Posted on 2004-09-13
8
Medium Priority
?
281 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 23

Accepted Solution

by:
Ferruccio Accalai earned 100 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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Assisted Solution

by:Ghitza
Ghitza earned 100 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 200 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 100 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

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!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

715 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