Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Server Job happening 5 times every day??
Thu, Apr 6 2023 10:09 PMPermanent Link

Ian Branch

Avatar

Hi Team,
I have a Server Backup Job that runs at 0800 every day.
The code for the Job is as follows..
{sql}
BEGIN

USE DBiWorkflow;

EXECUTE IMMEDIATE 'BACKUP DATABASE "DBiWorkflow" AS "DBiWorkflow-Server Full Backup - ' + CAST(CURRENT_DATE AS VARCHAR(10) DATE FORMAT 'yyyy-mm-dd')+ ' @ ' + CAST(CURRENT_TIME AS VARCHAR(4) TIME FORMAT 'hhmm')+ '" TO
STORE "Backups" COMPRESSION 9 INCLUDE CATALOG';

EXECUTE IMMEDIATE 'Insert into BackupsLog (DateTime, FromDate, ''DBiWorkflow'', BackupType, CreatedBy) values (CURRENT_TIMESTAMP, CURRENT_DATE, ''Workflow Full'', ''Server'')';

END
{sql}
I see in  the BackupsLOg that it has run at 0800, 0801, 0802, 0803 & 0804 every day.  With the backup file naturally being the same size.
Any thoughts at to what might be going on here??

Regards & TIA,
Ian
Thu, Apr 6 2023 10:10 PMPermanent Link

Ian Branch

Avatar

Should have mentioned..  Win 11, latest EDBSrvr.
Fri, Apr 7 2023 2:39 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


I can't spot anything there but others might, however, I suspect the job definition itself, can you share that code?

Roy Lambert
Fri, Apr 7 2023 4:35 AMPermanent Link

Ian Branch

Avatar

Hi Roy,
This what you want??
CREATE JOB "Workflow Full Backups"
RUN AS "Administrator"
FROM DATE '2018-10-06' TO DATE '2099-10-09'
EVERY 1 DAYS
BETWEEN TIME '08:00' AND TIME '08:30:00.999'
BEGIN

USE DBiWorkflow;

EXECUTE IMMEDIATE 'BACKUP DATABASE "DBiWorkflow" AS "DBiWorkflow-Server Full Backup - ' + CAST(CURRENT_DATE AS VARCHAR(10) DATE FORMAT 'yyyy-mm-dd')+ ' @ ' + CAST(CURRENT_TIME AS VARCHAR(4) TIME FORMAT 'hhmm')+ '" TO
STORE "Backups" COMPRESSION 9 INCLUDE CATALOG';

EXECUTE IMMEDIATE 'Insert into BackupsLog (DateTime, FromDate, ''DBiWorkflow'', BackupType, CreatedBy) values (CURRENT_TIMESTAMP, CURRENT_DATE, ''Workflow Full'', ''Server'')';

END

It is worth mentioning that exactly the same Job is running at mt Customers and it only runs once each day.

Ian
Fri, Apr 7 2023 8:54 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


<<It is worth mentioning that exactly the same Job is running at mt Customers and it only runs once each day.>>

Indubitably Watson Smiley

If it was taking a minute to run and running every minute I'd say it was sort of doing what you asked but only 5 times baffles me, and if it runs properly on one machine but not another there must be some difference.

I'm wondering if the alternative syntax

CREATE JOB "Tester"
RUN AS "Administrator"
FROM DATE '2023-04-07' TO DATE '2023-04-30'
DAILY ON MON, TUE, WED, THU, FRI, SAT, SUN
BETWEEN TIME '08:00' AND TIME '08:30:00.999'
BEGIN
....
....
END
VERSION 1.00

would work better

Roy Lambert
Fri, Apr 7 2023 12:03 PMPermanent Link

Raul

Team Elevate Team Elevate

<<
Ian Branch wrote:

Hi Team,
I have a Server Backup Job that runs at 0800 every day.
The code for the Job is as follows..
...
I see in  the BackupsLOg that it has run at 0800, 0801, 0802, 0803 & 0804 every day.  With the backup file naturally being the same size.
Any thoughts at to what might be going on here??

Regards & TIA,
Ian
>>

Ian

I suspect a failure (like exception thrown or such) - job is configured to run between 8/8:30 and will retry in case of a failure if it's inside interval still.

Raul
Fri, Apr 7 2023 5:17 PMPermanent Link

Ian Branch

Avatar

Hi Raul:
Good call.
Here is the revised SQL.
{sql}
BEGIN

USE DBiWorkflow;

EXECUTE IMMEDIATE 'BACKUP DATABASE "DBiWorkflow" AS "DBiWorkflow-Server Full Backup - ' + CAST(CURRENT_DATE AS VARCHAR(10) DATE FORMAT 'yyyy-mm-dd')+ ' @ ' + CAST(CURRENT_TIME AS VARCHAR(4) TIME FORMAT 'hhmm')+ '" TO
STORE "Backups" COMPRESSION 9 INCLUDE CATALOG';

EXECUTE IMMEDIATE 'Insert into BackupsLog (DateTime, FromDate, Database, BackupType, CreatedBy) values (CURRENT_TIMESTAMP, CURRENT_DATE, ''DBiWorkflow'',''Workflow Full'', ''Server'')';

END
{sql}
You will note the change in the Insert into BackupsLog, to the  3 rd parameter and the 3rd value.   My bad!
All good now.
The reason it didn't have any issues in the Customer's case is that I haven't implemented the 3rd parameter/value yet.

Regards & Tks to all,
Ian
Fri, Apr 7 2023 5:34 PMPermanent Link

Ian Branch

Avatar

Use the tools Ian, use the tools....
If I had bothered to look at the System Events Log I would have seen exactly what was going on..  
Doh! on me!
Image