Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 11 total |
Start a Server Job from an Application? |
Sat, Mar 21 2020 8:21 PM | Permanent Link |
Ian Branch | Hi Team,
My edbsrvr has a Backup Job that normally triggers around 0430. I want to be able to trigger it from an App at other times if possible. Can I ? If so, how please? Regards, Ian |
Mon, Mar 23 2020 2:00 PM | Permanent Link |
Terry Swiers | Hi Ian,
> My edbsrvr has a Backup Job that normally triggers around 0430. I want to be able to trigger it from an App at other times if possible. Can I ? If so, how please? Move the backup job to a procedure, then rewrite the backup job to call the procedure. This gives you the ability to then call the same procedure from the application as well on demand. |
Mon, Mar 23 2020 8:59 PM | Permanent Link |
Ian Branch | Hi Terry,
Sounds like a plan. I haven't done a procedure before. I created the following.. {sql} CREATE PROCEDURE "WorkflowBackup" () BEGIN BACKUP DATABASE "DBiWorkflow" AS "DBiWorkflow-Server Backup-' + CAST(CURRENT_DATE AS VARCHAR(10)) + '" TO STORE "Backups" COMPRESSION 9 INCLUDE CATALOG; END VERSION 1.00 {sql} But I get the following error.."ElevateDB Error #700 An error was found in the statement at line 3 and column 8 (Expected : but instead found DATABASE)" I know this works as a Job, why doesn't it work for a procedure? Ian |
Tue, Mar 24 2020 1:03 AM | Permanent Link |
Terry Swiers | > I know this works as a Job, why doesn't it work for a procedure? Open up EDB Explorer, right click on the job, and select Execute Job as a Script. This will give you what you need for the body of the procedure. Terry |
Tue, Mar 24 2020 4:01 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Ian
If you want to run it in your application there is another cheat way of doing it. Have a look in EDBManager at the result from the following select * from configuration.jobs One column is Definition which is exactly what it says. You should be able to create a query in your application to read this (eg select Definition from configuration.jobs where Name = 'Ians Job') then you put the data from Definition as the sql for a query and simply run it. Roy Lambert |
Tue, Mar 24 2020 4:45 AM | Permanent Link |
Ian Branch | Roy, Terry,
Thank you for your inputs. So, it appears that the Procedure prefers the Script style. {sql} BEGIN EXECUTE IMMEDIATE 'BACKUP DATABASE "DBiWorkflow" AS "DBiWorkflow-Server Backup-' + CAST(CURRENT_DATE AS VARCHAR(10)) + '" TO STORE "Backups" COMPRESSION 9 INCLUDE CATALOG'; EXECUTE IMMEDIATE 'DROP DATABASE"DBiWorkflow"'; END {sql} This was accepted when creating the procedure. If I now attempt to execute the procedure in edbmgr I get a 'Cannot lock the databse DBiWorkflow for exclusive access" @ Line 4, column 19, error message. There is nothing at Line 4 column 19. Ian |
Tue, Mar 24 2020 4:48 AM | Permanent Link |
Fernando Dias Team Elevate | Ian,
BEGIN EXECUTE IMMEDIATE 'BACKUP DATABASE "DBiWorkflow" ... -- Fernando Dias [Team Elevate] |
Tue, Mar 24 2020 4:53 AM | Permanent Link |
Ian Branch | Ahhh. So it automatically inserts SCRIPT at the start.
Hence Line 4 is in fact "EXECUTE IMMEDIATE 'DROP DATABASE"DBiWorkflow"';" Removing this line makes it all work. Thank you. Ian |
Tue, Mar 24 2020 5:06 AM | Permanent Link |
Ian Branch | OK. I am missing a syntax here.
The Procedure runs fine. I have found out how to call the procedure from Delphi. What I can't figure/find the syntax, is how to call the procedure from inside the Job. Help. Regards & TIA, Ian |
Tue, Mar 24 2020 5:13 AM | Permanent Link |
Ian Branch | Ahhh Ha!
{code} SCRIPT BEGIN CALL WorkflowBackup; END {code} |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Sunday, May 19, 2024 at 08:46 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |