I need to run a data definition update on databases with runtime license installed only. I've been following the process in this KB article http://knowledgebase.progress.com/articles/Article/P4760 which works fine when doing it manually so that I can click away any errors and post-update notifications.
The issue is that I'm trying to automate this through our maintenance procedure which runs os-command with the prowin32 call to the update procedure and that it freezes the maintenance with lock messages and other post-update prompts.
Is there anyway that I can suppress those or force termination of the process so that it can continue on with the maintenance procedure? I have tried adding -lkwtmo 60 and -rr as startup parameters but it still doesn't help with terminating the process.
Currently the command being passed through to os-command is:
"prowin <dbname> -H <DBSERVER> -S <PORT> -U <username> -P <password> -lkwtmo 60 -rx -p p-updatedf.p -rr -param delta.df"
And in p-updatedf.p, I simply have:
Sorry, my example was not very clear. Put the PAUSE statement before the FIND FIRST, you should see the schema lock. The schema lock is not in response to running lines of ABL. When the AVM loads the program, it checks for database references, and will get the schema lock as necessary, before running any code. Hence the debugger doesn't provide the granularity for you to see when the lock is obtained. You could use RCODE-INFO:DB-REFERENCES on RunOnlineUpdate.r (you have to compile it to .r). It will confirm whether there are database references. Or maybe compile it without any database connected.
Thanks Garry. The issue is that I'm getting a schema lock even before I reference any database tables because I'm calling the online update procedure within the maintenance procedure.
What happens is that say we initiate the maintenance by running RunMaintenance.p. In that procedure, we only have 2 calls:
ConnectAsAdmin.p simply elevates the current user to an admin user with permissions to make changes to the schema. If I put a break point between run ConnectAsAdmin.p and run RunOnlineUpdate.p and check promon then, there are no schema locks.
However, if I put a break point right at the start of RunOnlineUpdate.p before any definitions or database references takes place, I get the SHR lock. I'm assuming it's due to transaction scoping but I'm not sure how to get around it.
Ah right, I see what you mean. I didn't know that it would check the code for any references and lock at that point. I think I know what I need to do then to get rid of the lock. Thanks for your help!
the reason it works this way is that once a compiled program that contains database references starts running, (some) schema changes must be prevented in order for the compiled bytecode to remain valid during its execution.
(a .p is compiled just before it starts running)