Does APEX make it possible to call a script using dbms_scheduler, utl_file or other
and grab it's output?
The goal is to pass a command to an external API and show a popup either if an exception is generated or a sucess message is received.
Thanks
Assuming that the script is a file on the database server's operating system, you should be able to invoke the script from APEX using either DBMS_SCHEDULER or via a Java stored procedure. Personally, I'd tend to use the Java stored procedure approach just because that's what I've used in the past but it's solely a matter of personal preference.
Related
I've always developed shell scripts on server Unix where the script before runs the SQL-Loader for loading the file to be inserted into an Oracle table and after verifies if it's been generated any BAD file and in that case for example it sends an email to me with a warning.
Instead, by using an external table, I've got the main advantage not to handle any shell scripts but since only at the moment I run the SELECT from my external table a BAD file might be generated on the server, how can I have an automated check on its existence and to handle it from Oracle?
Oracle version 10g
Thanks!
With external tables, everything you do, you do in Oracle (i.e. within the database).
Therefore, you could
create a PL/SQL program (anonymous PL/SQL block or a stored procedure)
access the external table
do whatever you do
after it is finished, use UTL_FILE to check log/bad file
use DBMS_MAIL to send an e-mail if there's something "wrong"
I have an assignment in a class which requires the transfering of data from tables in one schema to another using the sqlldr tool. I have set up my control files, and text files(.csv files if you prefer) in order to transfer the data using sqlldr. Now I am using ORACLE 10g Enterprise Edition Release 10.2.0.1.0. I am all ready to go but when I type in the sqlldr command, or event just "sqlldr" I get the unknown command message. Am i just completely off or does this mean this utility isnt available on this version? I have the ingredients needed to make it happen but I cant figure out why I cant get sqlldr to run. Perhaps someone can point me in the right direction. Below is the specific syntax we were given in class.
sqlldr username/password control=loadsals.ctl
The user you are logged in under does not have access to SQLLDR. You will need to elevate your access via sudo or use another login that does have access.
Say I have a SQL script physically stored on the database server. Is there a SQL command I can send Oracle from an application to tell it to execute that script?
(Yes, I know this sounds ridiculous. I'm considering it as part of a work around of a very nasty problem that "shouldn't happen" but does.)
The easiest option would generally be to use the dbms_scheduler package to run an external job. This would let you invoke a shell script that started SQL*Plus, connected to the database, and ran your .sql script.
It would also be possible to create a Java stored procedure that uses Java's ability to call out to the operating system to run the same shell script. That tends to be a bit more of a security issue, though, since you're ending up granting the owner of this procedure privileges to run any command on the database server as the oracle user. That would include things like connecting to the database as SYSDBA or corrupting the database (accidentally or intentionally) so it's something that auditors would generally frown upon.
Can anyone please suggest a way to invoke an Oracle stored procedure from a shell script without the use of SQL*Plus, or any such client for that matter. The inability to install clients is a limitation of the server that I work on.
I have to schedule an Autosys script to invoke the job which invokes the Oracle stored procedure. Can you please suggest in what direction should I proceed?
You could do this using Java and jdbc. If you can not even copy the thin jdbc driver, I see no other option than to schedule the job in Oracle Using Oracle Scheduler.
Without client software installed, you'll have a hard time getting to Oracle from a shell script; however, Oracle has it's own batch facility--see Database jobs here
Is there any easy way to save BLOB as a binary file into client-side file system with using of only standard Oracle utilities (such as sqlplus or sqlldr for example)?
I've already looked onto UTL_FILE package, but actually I have two problems with it:
I have doubts that it can work with client-side file system.
I have no privilege to CREATE DIRECTORY in schema where BLOBs are saved and so that I can't work with UTL_FILE at all.
Also, I know that I can just write some homebred utility in any language (Java for example); connect to Oracle, select my BLOB and save it in binary format. But I'd look for some easier way before doing this.
Would you really want a database writing a BLOB, for example winword.exe, to your local PC ? This is the sort of thing that is intentionally quite protected.
It is very client driven, so the best place to start is with whatever is running on your local machine. I'd go with a Java routine, or if you've got APEX running, a simple procedure that will push the BLOB out through the browser and let the browser prompt you for what to save it.