Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 19 total
Thread What happens to JOBs if the server is turned off?
Wed, Jul 13 2016 12:32 AMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi

I have JOBs set up on the server like this:-
---------------------------------------------
CREATE JOB "DB1100_Friday"
RUN AS "System"
FROM DATE '2000-01-01' TO DATE '2030-12-31'
DAILY ON FRI
BETWEEN TIME '17:00' AND TIME '20:00'
CATEGORY 'UserBackups'
BEGIN
.....
END
---------------------------------------------

.... with one job for each day of the  week.

What is supposed to happen if someone powers off the server before 5pm
on the Friday - looking forward to a good weekend?

When the server is restarted on Monday does it proceed to execute
Friday, Saturday and Sunday's jobs?

Or does it just forget those overdue jobs?  The manuals seem silent on
this matter.

Cheers

Jeff
Wed, Jul 13 2016 3:07 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


I was going to say run the following

select * from configuration.jobs

and look at the NextRun column - but I did and its blank.

I know the job's running because I just looked at the timestamp of files and yesterday's backup was there - shouts TIM -WTF???

Roy Lambert
Wed, Jul 13 2016 3:16 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Hmmm - Enabled is false as well.so according to the OLH <<The NextRun column will be NULL for any jobs that are disabled.>> But if its not enabled - how is it running?



Found the ENABLE JOB / ENABLE JOBS commands the latter tells me 1 row affected but select * from jobs still shows Enabled as False

I am now officially baffled.


Roy Lambert
Wed, Jul 13 2016 4:56 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


If its the same job each day and you have 5 to change the name here's what I did

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, Jul 13 2016 9:57 AMPermanent Link

Raul

Team Elevate Team Elevate

On 7/13/2016 12:32 AM, Jeff Cook wrote:
> ---------------------------------------------
> CREATE JOB "DB1100_Friday"
> RUN AS "System"
> FROM DATE '2000-01-01' TO DATE '2030-12-31'
> DAILY ON FRI
> BETWEEN TIME '17:00' AND TIME '20:00'
> CATEGORY 'UserBackups'
> BEGIN
> ....
> END
> ---------------------------------------------
> When the server is restarted on Monday does it proceed to execute
> Friday, Saturday and Sunday's jobs?

I recall testing this few years ago and I pretty sure it will not run
missed job - as long as the server is down for the entire internal (i.e.
from 1700-2000).

If it's turned on and there is a job with valid interval due it gets run
right away - say they turn it off at 1600 and then turn it back on at
1900 then it should run the current job right away.

> Or does it just forget those overdue jobs?  The manuals seem silent on
> this matter.

Yes - it's not about forgetting as much as that job has no valid run
window anymore (i.e. til next Fri for the one shown above) so it can't run.

If this is a regular concern then i would suggest creating another job
that runs at server start - this would execute whenever the server is
started and you end you with some extra backups (i guess monday
mornings) but at least you'd have a backup.

Raul
Wed, Jul 13 2016 5:20 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

On 14/07/2016 1:57 a.m., Raul wrote:

>
> Yes - it's not about forgetting as much as that job has no valid run
> window anymore (i.e. til next Fri for the one shown above) so it can't run.
>
> If this is a regular concern then i would suggest creating another job
> that runs at server start - this would execute whenever the server is
> started and you end you with some extra backups (i guess monday
> mornings) but at least you'd have a backup.
>
> Raul

Hi Roy and Raul

The reason for my question was that one user is having a problem that
multiple backups have been created at about 2 minute intervals - which
is about the time it takes to run the backup.

Unfortunately, the user has deleted them before I've had a chance to
examine them because they were munching GB's of his disk.  So my
question came from theorising at to what might have happened.

If Raul is correct, and he usually is Winkthen I'll have to look
elsewhere for what is causing the problem.  If Tim is listening in, it
would nice to know for sure about jobs being skipped if the server isn't
running during the run window.

Roy's JOB is much more elegant than mine, but my requirements are a
little different.  I have a GUI where the user can enable/disable for
each day, select different times each day and optionally copy the backup
to our cloud server.

Thank you Roy and Raul for your

                                                                  insights

Cheers

Jeff
Thu, Jul 14 2016 4:19 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


>The reason for my question was that one user is having a problem that
>multiple backups have been created at about 2 minute intervals - which
>is about the time it takes to run the backup.

My first thought reading your paragraph above was "there's two servers being run". I don't know if that's possible or not. Was it you that's doing something with failover servers?

For that to happen if your initial thoughts were right (and I also think Raul is right so your thoughts are wrong Smiley that would mean that either the Friday backup waited until its correct timeslot on the Monday (that would indicate Tim went really weird - hmm unlikely)  or you have another backup running.

Did the user happen to record the time the backups happened? That triggered a thought - query the jobs table and see what it lists as having run and when

SELECT Name, LastRun, StartTime,  EndTime FROM Jobs


>Roy's JOB is much more elegant than mine,

Thank you kind sir.

>but my requirements are a
>little different. I have a GUI where the user can enable/disable for
>each day, select different times each day and optionally copy the backup
>to our cloud server.

That say's to me "SUSPECT THE USER" - always a good start point!

If you're still having trouble then I suggest serialising the backup jobs with a unique file name - at least then you should be able to track down the offending job.

Roy Lambert
Thu, Jul 14 2016 7:22 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff,

<< What is supposed to happen if someone powers off the server before 5pm on the Friday - looking forward to a good weekend? >>

Raul's answer is correct - the EDB Server will only run jobs that are valid to schedule for running *right now*.  If the server is down during the run window, then the job will simply be missed.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jul 14 2016 7:23 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< and look at the NextRun column - but I did and its blank.

I know the job's running because I just looked at the timestamp of files and yesterday's backup was there - shouts TIM -WTF??? >>

What version are you using ?  There was a bug in the NextRun calculations that was fixed recently.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jul 14 2016 8:47 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


EDBManager says 2.24b2 and just checked the server - ditto - but the job would have been set before that, and the catalog is positively antique.

Do I need to delete the job & recreate it?


Roy Lambert
Page 1 of 2Next Page »
Jump to Page:  1 2
Image