niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle » Tools
Automate SQL Question
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
indiagirl
*nix forums beginner


Joined: 17 Jul 2006
Posts: 2

PostPosted: Mon Jul 17, 2006 8:31 pm    Post subject: Automate SQL Question Reply with quote

I need to generate reports on one database (SQL statements developed to

build delimited files), load them into a test database (control files
built using sql loader), and then update certain tables based on the
new information received within the test database (SQL update
statements built to do this). I need help with a simple way to develop
an automated process to do this. If someone could point me in the right

direction for a beginner.
Back to top
Malcolm Dew-Jones
*nix forums Guru


Joined: 04 Mar 2005
Posts: 418

PostPosted: Mon Jul 17, 2006 9:14 pm    Post subject: Re: Automate SQL Question Reply with quote

indiagirl (erin.l.anderson@citigroup.com) wrote:
: I need to generate reports on one database (SQL statements developed to

: build delimited files), load them into a test database (control files
: built using sql loader), and then update certain tables based on the
: new information received within the test database (SQL update
: statements built to do this). I need help with a simple way to develop
: an automated process to do this. If someone could point me in the right

: direction for a beginner.


Oracle has a nice new thing called BPEL that sounds like it should be easy
for a beginner to use - just drag and drop icons within JDeveloper to
define the steps to take (assuming everything is setup!).

Not used it yet though, so I don't know how easy it really is.


I would tend to write a shell script and run it from cron. Run the script
on a server that has access to all the databases.

Create a script that does the following...

Check that a flag file (see next step) does not exist. If it does then
fail with an error message. The cron job error will be mailed to
someone and they can manually check what went wrong last time.

touch the flag file to create it to indicate you're working

use sqlplus to connect to the first database and run the extract
scripts. spool or pipe the output to local file(s)

use sqlldr to connect to the test database and run the control files
with the data files just saved.

use sqlplus to connect to the final database and run the update scripts
to merge in the new data

rename the various files so you have a nice dated copy of what you did.

delete or rename the flag file

maybe send a mail message (maybe not as cron will already send its
output).


Now schedule that script to be run in cron (well actually next step is to
test it manually first, but I assume you realize that).

If the output of one step is not quite what you need as the input of the
next step then add a few lines to your script to fix that problem. I
typically use perl, but things like grep, sed, awk and pretty common too.


On a windows server, write a batch file to do the same thing. Perl is the
best bet to use if you need to do any data fix ups. schedule the batch
file using the AT command. Getting output is harder on windows, so save
all the messages into a log file (perhaps on an easily accessible network
share) and then make sure someone reads the logs files once in a while.


$0.10
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Tue Dec 02, 2008 12:03 am | All times are GMT
navigation Forum index » Databases » Oracle » Tools
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Newbie question: How to forward a domain to a mailbox? leei Postfix 0 Fri Aug 24, 2007 4:55 pm
No new posts configuration question for httpd Karl Wang Apache 1 Fri Jul 21, 2006 2:10 pm
No new posts nim problem/question Ron AIX 0 Fri Jul 21, 2006 1:57 pm
No new posts question for JAVA developer who r using postgres sql as b... deepak pal PostgreSQL 1 Fri Jul 21, 2006 9:00 am
No new posts Encryption Question dtuttle1@gmail.com Berkeley DB 2 Thu Jul 20, 2006 10:09 pm

Nancy Ajram | Secured Loans | Loans | Loans | Gas Suppliers
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1733s ][ Queries: 16 (0.1039s) ][ GZIP on - Debug on ]