Solved

Oracle 8i - continuous running procedure

Posted on 2001-07-19
3
311 Views
Last Modified: 2008-03-04
I need to do the following:

Create a stored procedure that will reside in an Oracle 8i database running on Windows 2000.  This procedure needs to be running at all times when the database is running.  The purpose of the procedure is to execute a query on some SQL Server tables via the SQL Server gateway.  (SQL Server 6.5 is also running on Windows 2000).  If new records are found in the SQL Server tables, then execute more Oracle procedures/functions.  This query needs to be ran every 5 to 10 seconds to check and see if new records exist.  If the Oracle database goes down, this procedure needs to be started immediately after the database is available.  If the SQL Server connection is lost for any reason, a new connection needs to be created.  Any advice on how best to accomplish this task.
0
Comment
Question by:mkwdrs
3 Comments
 
LVL 47

Expert Comment

by:schwertner
ID: 6301085
To schedule when to run subprograms use the Oracle Supplied Package DBMS_JOB:

SUBMIT Procedure
This procedure submits a new job. It chooses the job from the sequence sys.jobseq.

Syntax
DBMS_JOB.SUBMIT (
   job       OUT BINARY_INTEGER,
   what      IN  VARCHAR2,
   next_date IN  DATE DEFAULT sysdate,
   interval  IN  VARCHAR2 DEFAULT 'null',
   no_parse  IN  BOOLEAN DEFAULT FALSE,
   instance  IN  BINARY_INTEGER DEFAULT any_instance,
   force     IN  BOOLEAN DEFAULT FALSE);

Parameters
Table 17-2 SUBMIT Procedure Parameters
Parameter  Description  
job

  Number of the job being run.
 
what

  PL/SQL procedure to run.
 
next_date

  Next date when the job will be run.
 
interval

  Date function that calculates the next time to run the job. The default is NULL. This must evaluate to a either a future point in time or NULL.  
 
no_parse

  A flag. The default is FALSE. If this is set to FALSE, then Oracle parses the procedure associated with the job. If this is set to TRUE, then Oracle parses the procedure associated with the job the first time that the job is run.

For example, if you want to submit a job before you have created the tables associated with the job, then set this to TRUE.  
 
instance

  When a job is submitted, specifies which instance can run the job.
 
force

  If this is TRUE, then any positive integer is acceptable as the job instance. If this is FALSE (the default), then the specified instance must be running; otherwise the routine raises an exception.
 
 

Usage Notes
The parameters instance and force are added for job queue affinity. Job queue affinity gives users the ability to indicate whether a particular instance or any instance can run a submitted job.

Example
This submits a new job to the job queue. The job calls the procedure DBMS_DDL.ANALYZE_OBJECT to generate optimizer statistics for the table DQUON.ACCOUNTS. The statistics are based on a sample of half the rows of the ACCOUNTS table. The job is run every 24 hours:

VARIABLE jobno number;
BEGIN
   DBMS_JOB.SUBMIT(:jobno,
      'dbms_ddl.analyze_object(''TABLE'',
      ''DQUON'', ''ACCOUNTS'',
      ''ESTIMATE'', NULL, 50);'
      SYSDATE, 'SYSDATE + 1');
   commit;
END;
/
Statement processed.
print jobno
JOBNO
----------
14144

0
 
LVL 54

Expert Comment

by:nico5038
ID: 7487642

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7518874
Per recommendation, points NOT refunded and question closed.

Netminder
EE Admin
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping1 challenge 7 90
Installed softare without GUID 6 73
Counting documents in a Domino View 3 82
Please explain: Aspect Oriented Programming 2 92
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question