| |
 |
|
Other Oracle Tasks
Oracle Tips by
Burleson
|
Almost any task can be automated. There are several factors that
come into play when deciding whether a task should be performed with a
script:
-
Complexity—If a task requires a complex
set of conditions to perform, then a script may be required to
repeat the steps until the task is completed (even if the task will
never be performed again).
-
Repetition—If the task will need to be
repeated regularly, a script might be ideal for the job. This
reduces the amount of monotonous work that must be done by the DBA
or developers because the script can simply be run as a cron
job.
-
Interaction— If a task requires little
or no interaction, a script can easily perform the task. If
interaction is required, it should be required at the start of the
task. (This type of interaction often involves setting up parameters
for the script.)
-
Functionality—If the functionality of
the task can be expressed in code, a script can do the job. For
instance, a script can double-check account balances with ease, but
it would take a bit of work to make a script understand when an
account balance that sums properly is still wrong.
Let’s consider several tasks and determine whether or not the task
should be scripted.
Daily Conversion of Data from a
Legacy System
Every day a set of data must be loaded from the university’s
mainframe system. Some special applications have been developed on the
mainframe, and IS (that’s you) hasn’t had time to implement those
special applications on the new system. Consider these points:
-
The data from the mainframe always comes in the
same format.
-
The data doesn’t require complex
interpretation.
-
The data must be imported every morning before
the start of business.
Given these conditions, this task should definitely be scripted.
Pattern Analysis of Stock Trends
The Vice President of Finance wants to see a report of trends in
the university’s investments. The stock prices are keyed into the
database by his secretary every morning, but the standard report
doesn’t help him predict where the investments are going.
- • You have all the data needed for the report, but it’s
not 100 percent reliable. (Remember, the Vice President’s secretary
keys the data in by hand every morning, and everyone makes
mistakes.)
- • The code for the report would have to follow some
logical method of predicting trends in the stock market, but a large
part of predicting trends is intuition.
- • The Vice President wants to see this report once.
Unless you’ve created a reliable method for predicting where stock
prices are going and can translate that method into simple logical
steps, you’re unlikely to have any success using a script to generate
a usable report. (And let’s face it, if you had created a reliable
method of predicting where stock prices are going, you probably
wouldn’t be working for a living.)
This is an excerpt from the book "High Performance Oracle
Database Automation" by Jonathan Ingram and Donald K.
Burleson, Series Editor. |