Solved

Oracle 8i - continuous running procedure

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
withoutTen challenge 14 88
Visual xHarbour 1 76
Eclipse Neon start with Admin account only 6 46
Path to Python 9 39
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now