Usually, I know right away if something goes bad but you can create folders
for each hour and have that hours backup go in that folder.
I use the hour for each folder name in this example. Assuming that the
folders are created(ie c:\BACKUPS\01\, c:\BACKUPS\02, c:\BACKUPS\03\...)
You would have 24 hours of backups before one is overwritten.
Connect dbname
SET VAR vtablename TEXT,vfilename TEXT
--get the hour for folder location of backup
Set var vfolder TEXT = (CTXT(IHR(.#time)))
--delete previous backup
delete c:\backups\*.dat
--gets only the table data
DECLARE cursor1 CURSOR FOR SELECT sys_table_name FROM sys_tables +
WHERE sys_table_type = 'table'
OPEN cursor1
FETCH cursor1 INTO vtablename INDICATOR vi1 WHILE SQLCODE <> 100 THEN
SET VAR vfilename = ('C:\BACKUPS\' + .vfolder + '\' + .vtablename +
'.dat')
OUTPUT &vfilename
UNLOAD DATA FOR &vtablename
OUTPUT SCREEN
FETCH cursor1 INTO vtablename INDICATOR vi1
ENDWHILE
DROP CURSOR cursor1
CLEAR VAR v%
exit
Dan Goldberg
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of James
Bentley
Sent: Monday, June 16, 2008 5:04 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Hourly Backups
Dan,
Interesting code. One observation. You delete the previous backup before
the new one completes. What happens if current backup fails. You would
have lost your previous backup.
Jim Bentley
American Celiac Society
[EMAIL PROTECTED]
tel: 1-504-737-3293
--- On Mon, 6/16/08, Dan Goldberg <[EMAIL PROTECTED]> wrote:
> From: Dan Goldberg <[EMAIL PROTECTED]>
> Subject: [RBASE-L] - RE: Hourly Backups
> To: "RBASE-L Mailing List" <[email protected]>
> Date: Monday, June 16, 2008, 2:58 PM
> I run this file every hour on my server. I run it on the server
> because it only takes a couple of seconds to run vs. network traffic.
>
> This places each table's data in its own file due to the file sizes
> gets to be rather large. I do not backup the structure hourly because
> it does not change. If I need to restore I pull the previous nights
> backup and restore the table's data that has changed for the day.
>
> Connect dbname
> SET VAR vtablename TEXT,vfilename TEXT
>
> --delete previous backup
> delete c:\backups\*.dat
>
> --gets only the table data
> DECLARE cursor1 CURSOR FOR SELECT sys_table_name FROM sys_tables +
> WHERE sys_table_type = 'table'
> OPEN cursor1
> FETCH cursor1 INTO vtablename INDICATOR vi1 WHILE SQLCODE <> 100 THEN
> SET VAR vfilename = ('C:\BACKUPS\' + .vtablename + '.dat')
> OUTPUT &vfilename
> UNLOAD DATA FOR &vtablename
> OUTPUT SCREEN
> FETCH cursor1 INTO vtablename INDICATOR vi1 ENDWHILE DROP CURSOR
> cursor1 CLEAR VAR v% exit
>
> Dan Goldberg
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Dan
> Sent: Monday, June 16, 2008 12:18 PM
> To: RBASE-L Mailing List
> Subject: [RBASE-L] - Hourly Backups
>
>
>
>
> After loosing a day last week and having to revert to yesterdays
data
> (only for a while thank God)
>
>
> I was wondering if anyone has ideas on hourly backup
> routines?
>
> I ran an import which went awry, and R:base allowed itself
> to grow past the
> 2 gig limit making the whole database unusable.
>
> Is anyone using a backup procedure that would allow you to
> be up to the
> hour?
>
> Thanks in advance.
>
> Dan Champion
>
> Service Department Manager
> Vredevoogd Heating & Cooling
> Grandville, MI. 49418
> 616-534-8271 x 14