Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Oracle 8i - continuous running procedure

Posted on 2001-07-19
3
313 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 48

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
listing all functions in JavaScript 19 216
Path to Python 9 128
VbScript to countdown to New Year's Day 6 64
learn programming 8 31
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…

809 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