Forum Stats

  • 3,784,352 Users
  • 2,254,928 Discussions
  • 7,880,790 Comments

Discussions

Checking if Script is Already Running

850978
850978 Member Posts: 24
edited May 4, 2011 8:14AM in .NET Stored Procedures
Hello All:

I am writing a batch file that will fire off an Oracle Stored Procedure using something along these lines:
IF "%%~nxV" EQU "FILE1" sqlplus username/[email protected] @c:\folder\sql\sqlfile.sql

If there some way to know if SQLFILE.SQL is already running so we don't call the process twice? Preferabbly from a batch file / command prompt.

Thanks
Andy

Answers

  • user477000
    user477000 Member Posts: 144
    You might set specific action or client info in dbms_application_info and then eventually look for it.
    The other option is using global context or a table.

    BTW, I'd move it to procedure itself (to let it being processed just once) or consider using queues/scheduler_jobs.

    You have not mentioned which DB version you're using.
This discussion has been closed.