Solved

Oracle Job Scheduling Execution

Posted on 2014-11-27
1
369 Views
Last Modified: 2014-11-30
Without being too technical about, I would like to know the usual steps that are taken to create and schedule a Job in Oracle and then have the server execute the job(Ex. A query that pulls the overnight orders) so that the Server (Windows)  at a specified time and perhaps save a csv copy of this file in a predefined location.
0
Comment
Question by:Benki Canoso
1 Comment
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40469811
You could use dbms_scheduler and a stored procedure to create the CSV and write it to a directory on the database server using UTL_FILE.  This requires writing some code but does keep it all in the database.

There are MANY samples of UTL_FILE and DBMS_SCHEDULER in the docs and online.

Here is the first link I found with a search:
http://nimishgarg.blogspot.com/2011/09/create-csv-file-using-plsql.html

You could also go with the simple:
Create a sql script and use sqlplus and schedule it from Windows Task Scheduler.

If the resulting CSV will not exceed 4000 characters something like this.

Create a script named mycsv.sql
set lines 4000
set trimspool on
set pages 0
set feedback off
spool c:\folder\mycsv.csv
select col1 || ',' || col2 || ',' || col3 from some_table;
spool off

Then from a CMD prompt:

sqlplus user/password @c:\script_dir\mycsv.sql
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

820 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