Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread Backup and delete backup jobs on ElevateDB Manager
Thu, Aug 6 2015 8:00 AMPermanent Link

Peter Evans

I am running Delphi's DataSnap that gets data from ElevateDb.

Previously in the EDBSession component I had
   SessionType = stRemote
I ran the ElevateDB Server first.

My daily backup job and daily delete backup job ran OK for a few months.

I have now changed the Session component
   SessionType = stLocal

Because the ElevateDB Server does not need to run I do not run the
ElevateDb Server. Thus the jobs don't get run.

How and where do I now run these important jobs?

Regards,
  Peter Evans
Thu, Aug 6 2015 8:23 AMPermanent Link

Adam Brett

Orixa Systems

>>Because the ElevateDB Server does not need to run I do not run the
>>ElevateDb Server. Thus the jobs don't get run.

I am sure you understand, this is intended. A programme must run to in turn run the JOBs. EDB Server does this normally.

>>How and where do I now run these important jobs?

My suggestion would be to create your own small programme in Delphi, or even a routine within your Delphi programme. This could check the date, and use this to say whether to run a script. The script could contain any EDB SQL, procedures etc. you wish.

You cannot run JOBs from a Delphi programme (so far as I know) but you can run Procedures, Functions etc., within SQL sent to a Query or StoredProc component.

Hope this is helpful.
Thu, Aug 6 2015 1:43 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Peter,

<< Because the ElevateDB Server does not need to run I do not run the
ElevateDb Server. Thus the jobs don't get run. >>

What Adam said is correct: the only way to schedule/run these jobs is via the ElevateDB Server.

However, if you want to keep them defined as scheduled jobs, but want to schedule/run them manually in your application, you can do so by doing what the EDB Manager does for one-off executions in the manager:

SELECT Definition FROM Configuration.Jobs
WHERE Name='MyJobName'

That will give you the job definition in the format:

JOB <JobName>
BEGIN
  -- Body
END

You can just strip off the JOB header and add a SCRIPT header in order to execute it as a script

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Aug 6 2015 8:31 PMPermanent Link

Peter Evans

Adam and Tim,

I will think through these approaches and report back.

Peter
Thu, Aug 6 2015 9:32 PMPermanent Link

Peter Evans

On 7/08/2015 3:43 AM, Tim Young [Elevate Software] wrote:

>
> You can just strip off the JOB header and add a SCRIPT header in order to execute it as a script

I was able to successfully do that for my daily backup job.

However when I did this for my daily delete backup job I got an error.
It was in this part of the code :-

        SELECT Name, ModifiedOn
        FROM Configuration."Files"
        WHERE Name LIKE '%Backup%'
          AND ModifiedOn <= (CURRENT_TIMESTAMP - INTERVAL '1' WEEK)

It did not like the WEEK. I had to change it to :-

        SELECT Name, ModifiedOn
        FROM Configuration."Files"
        WHERE Name LIKE '%Backup%'
          AND ModifiedOn <= (CURRENT_TIMESTAMP - INTERVAL '7' DAY)

Is there a problem here?

Regards,
  Peter Evans
Thu, Aug 6 2015 9:39 PMPermanent Link

Peter Evans

On 7/08/2015 3:43 AM, Tim Young [Elevate Software] wrote:

>
> However, if you want to keep them defined as scheduled jobs, but want to schedule/run them

manually in your application, you can do so by doing what the EDB
Manager does

for one-off executions in the manager:
>

So I have to convert from the Manager code :-

/* ALTER */  CREATE JOB Backup
RUN AS "System"
FROM DATE '2015-01-01' TO DATE '2015-05-31' /* YYYY-MM-DD */
DAILY
   BETWEEN TIME '10:00 AM' AND TIME '03:30 PM'

To some form of Delphi scheduling code? Any pointers on how to do that?

Regards,
  Peter Evans
Fri, Aug 7 2015 9:43 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Peter,

<< However when I did this for my daily delete backup job I got an error.
It was in this part of the code :-

        SELECT Name, ModifiedOn
        FROM Configuration."Files"
        WHERE Name LIKE '%Backup%'
          AND ModifiedOn <= (CURRENT_TIMESTAMP - INTERVAL '1' WEEK)

It did not like the WEEK. I had to change it to :- >>

There isn't any such thing as a WEEK interval.  Are you sure that your original job included that SQL ?

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Aug 7 2015 9:46 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Peter,

<< To some form of Delphi scheduling code? Any pointers on how to do that? >>

Do you have the EDB source code ?  If so, then you can get some information on how to do this in the edbconfig.pas unit:

function TEDBJob.RequiresScheduling: Boolean;

You could also use any number of task scheduling components for Delphi.  Here's one I found with a Google search:

http://www.sicomponents.com/taskscheduler.html

Tim Young
Elevate Software
www.elevatesoft.com
Sun, Aug 9 2015 7:36 PMPermanent Link

Peter Evans

On 7/08/2015 11:43 PM, Tim Young [Elevate Software] wrote:

>
> There isn't any such thing as a WEEK interval.  Are you sure that your original job included that SQL ?

My original job did! I have just looked in the LogEvents. I see a great
number of error messages. For example :-

An error was found in the statement at line 26 and column 8 (Expected
YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MSECOND but instead found WEEK)

That explains everything.

Regards,
  Peter Evans
Wed, Aug 12 2015 7:14 PMPermanent Link

Peter Evans


>
> You could also use any number of task scheduling components for Delphi.

Thanks for that idea. I have taken a different approach.

I have looked at Delphi versions of the Unix cron. I am looking at the
Cromis Library at www.cromis.net

This has the unit Cromis.Scheduler. (It pulls in Cromis.StringUtils,
Cromis.Unicode and Cromis.Utils)

This can be run inside my server. I will see where this leads me.

Regards,
  Peter Evans
Image