Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread Delete a Backup?
Tue, Aug 7 2018 10:48 PMPermanent Link

Ian Branch

Avatar




Attachments: Screenshot_2.jpg Screenshot_1.jpg
Wed, Aug 8 2018 12:12 AMPermanent Link

Raul

Team Elevate Team Elevate

On 8/7/2018 10:48 PM, Ian Branch wrote:
>
>    What I would like to do now is be able to set a mechanism to delete backups after x # of backups.  Say 30 for
> discussion purposes.
>

You can simply delete a file from store
(https://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=DELETE_FILE)
so question is how do you want this to work exactly.

Your backup/restore utility could easily query for any files in store
(it does it already based on screenshot) and delete based on your
criteria for X.

If you want to automate this to be completely in edbsrvr then you'd need
to create a job that does uses similar logic.

I personally prefer deleting files simply based on date so we always
know we have last 30 days worth of backups - using last x backups might
result in lot less time if there are sometimes multiple backups per day.

Raul
Wed, Aug 8 2018 12:19 AMPermanent Link

Ian Branch

Avatar

Hi Raul,
   Thank you for that.  I wasn't sure if there were any internal machinations that needed to occur.  If all that is
required is a file delete then all too easy.

Regards,
Ian
Wed, Aug 8 2018 12:33 AMPermanent Link

Steve Gill

Avatar

Hi Ian,

I use a job that calls a stored procedure to perform backups.  It then calls a method in an external module that deletes backups older than the last 30 (or whatever the user specifies - see attached screenshot).

= Steve



Attachments: Backups.png
Wed, Aug 8 2018 1:50 AMPermanent Link

Ian Branch

Avatar

Hi Steve,
   Nice. Smile
Regards,
Ian
Wed, Aug 8 2018 3:00 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


I being contrary decided 7 days was sufficient and set up a job to do a Monday - Sunday Schedule

CREATE JOB "Backup TfR"
RUN AS "System"
FROM DATE '2015-09-09' TO DATE '3000-10-21'
DAILY ON MON, TUE, WED, THU, FRI, SAT, SUN
BETWEEN TIME '18:44:45' AND TIME '19:44:45.999'
BEGIN DECLARE BackupCmnd VARCHAR DEFAULT '';
DECLARE ThisDay VARCHAR DEFAULT '';
DECLARE DBCursor CURSOR FOR DBStmt;
DECLARE StorePath VARCHAR DEFAULT '';
DECLARE StoreName VARCHAR DEFAULT 'buTfR';
DECLARE InfoCursor SENSITIVE CURSOR FOR InfoStmt;
PREPARE InfoStmt FROM 'SELECT * FROM Configuration.Stores WHERE Name=?';

USE TfRData;

SET ThisDay = 'TfR - ' + CASE EXTRACT(DAYOFWEEK FROM CURRENT_DATE)
                   WHEN 1 THEN 'Monday'
                   WHEN 2 THEN 'Tuesday'
                   WHEN 3 THEN 'Wednesday'
                   WHEN 4 THEN 'Thursday'
                   WHEN 5 THEN 'Friday'
                   WHEN 6 THEN 'Saturday'
                   WHEN 7 THEN 'Sunday'
                  END;

SET BackupCmnd = 'BACKUP DATABASE "TfRData" AS "' + ThisDay + '" TO STORE "buTfR" INCLUDE CATALOG';
    
OPEN InfoCursor USING StoreName;
IF (ROWCOUNT(InfoCursor) = 0) THEN
 PREPARE DBStmt FROM 'SELECT _ParamData FROM Config WHERE _ID = ''BackupPath''';
 OPEN DBCursor;
 IF (ROWCOUNT(DBCursor) = 1) THEN
  FETCH FIRST FROM DBCursor ('_ParamData') INTO StorePath;
  EXECUTE IMMEDIATE 'CREATE STORE "buTfR" AS LOCAL PATH '+QUOTEDSTR(StorePath);
 ELSE
  EXECUTE IMMEDIATE 'CREATE STORE "buTfR" AS LOCAL PATH '+QUOTEDSTR('C:\TfR Backups');
 END IF;
END IF;
CLOSE DBCursor;
CLOSE InfoCursor;

EXECUTE IMMEDIATE 'SET FILES STORE TO "buTfR"';
EXECUTE IMMEDIATE 'DELETE FILE "' + ThisDay  + '.EDBBkp" FROM STORE "buTfR"';

EXECUTE IMMEDIATE  BackupCmnd;

END
VERSION 1.00


Roy Lambert
Wed, Aug 8 2018 5:51 PMPermanent Link

Ian Branch

Avatar

Hi Roy,
   Informational and Educational to say the least. Wink
   I can follow, but not necessarily understand at this point, what you are doing there.
   It occurs to me that this is inteneded as a Job for the EDB server.  
   I don't believe that as it is it would work for Local mode where users are in & out of the Apps all day.
   No, I'm not asking for a change, just an observation. Smile The Customer is very happy with the App I have done.
   I may consider somethig like this when we go full C/S.

   Just in follow up to my original question - The Customer is currently vacillating about where and when and how many
backups he wants.  Until he makes a decision I'm not doing any more work on the subject.

Regards,
Ian
   
Thu, Aug 9 2018 1:52 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


>    Informational and Educational to say the least. Wink
>    I can follow, but not necessarily understand at this point, what you are doing there.
>    It occurs to me that this is inteneded as a Job for the EDB server.
>    I don't believe that as it is it would work for Local mode where users are in & out of the Apps all day.
>    No, I'm not asking for a change, just an observation. SmileThe Customer is very happy with the App I have done.
>    I may consider somethig like this when we go full C/S.

It is intended to run as a job in the server but strip out job specific stuff and it should run as a script. You just have to have some sort of control mechanism. In a file server system create a background thread that will activate the script when there's only one user logged in (presuming you do your own login/out control) and its not busy.

>    Just in follow up to my original question - The Customer is currently vacillating about where and when and how many
>backups he wants. Until he makes a decision I'm not doing any more work on the subject.

Parameterise dear boy Smiley

When you have five minutes to spare you might want to look at publishing - it could (sort of) be used to produce journals between backup points.

Roy
Thu, Aug 9 2018 2:38 AMPermanent Link

Ian Branch

Avatar

Roy Lambert wrote:

> When you have five minutes to spare you might want to look at publishing - it could (sort of) be used to produce
> journals between backup points.

Publishing??  I've only just got to grips with Stores, sorta. Wink
Thu, Aug 9 2018 5:59 PMPermanent Link

Raul

Team Elevate Team Elevate

On 8/9/2018 2:38 AM, Ian Branch wrote:
> Publishing??  I've only just got to grips with Stores, sorta. Wink
>

Stores knowledge will be useful.


Overall capability is called replication :

https://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=Replication

and there is also a sample article which explains the concept

https://www.elevatesoft.com/articles?action=view&category=edb&article=building_sales_quote_replication_system_elevatedb

and when Roy mentioned publishing it's part of this

https://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=PUBLISH_DATABASE

Raul
Image