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
Related
In my PL/SQL script, I have requirement to test the connectivity of remote data. Normally, in OS shell, we use command tnsping. Is there any command in SQL or PL/SQL so that I can test connectivity.
Basically, I am getting some data using database link. I want my script to execute immediately. If remote database is available then I want to run query using database link. If remote database is unavailable then I want to skip the getting of data using database link. So, this is the reason why I am looking for.
Kindly guide me for proper way. So, that my script does not hang in case of unavailability of remote database.
I am using Oracle 12.1C.
Is it possible to run commands on another Unix server from an Oracle apex application ?
Oracle apex and Unix are on different machines .
Apex is just a layer on top of the database.
From within the oracle database you can execute OS commands, so you could execute a script that connects from your database server over ssh.
or you could wrap your unix command in a cgi script and have it run of http. In pl/sql you could then invoke it via apex_web_service.make_rest_request
Make sure you check security
No you cannot. If your requirement is just to transfer the files, you can use ftp or sftp commands. But to perform unix operations, you cannot run in different machines
How to schedule a stored procedure in Netezza to run in specific intervals? Looking for replacement of DBMS_JOB or DBMS_SCHEDULER in Oracle . Or is it possible to invoke Netezza stored procedure through shell script?
Thanks
in our project we are calling the stored proc using nzsql(in shell script) and shell script is scheduled using autosys. if you are using any ETL tools like informatica u can use stored procedure transformation to execute netezza procedures.
There is no direct equivalent to DBMS_SCHEDULER or DBMS_JOBS in Netazza. Stored procedures, just like any SQL, can be called through a shell script using the nzsql CLI utility. Those shell scripts can then be scheduled to run via cron, or any another myriad of scheduling mechanisms.
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.
Here's a good one for any Oracle gurus out there. I'm working on a web page that dynamically configures Oracle DB backup settings in a closed environment. Right now, I have everything set up to generate scheduled jobs that run pre-determined RMAN scripts that already exist on the Database server's disk. This works, but I want to go a step further.
Is there any way to create jobs with the scheduler that will run RMAN scripts which haven't first been written to disk? For example, is it possible to fire off an RMAN backup script directly from the scheduler by using a pipe of some sort? I've found some vague information on the RMAN Pipe Interface, but I can't see how I could create a private pipe, pack it with RMAN commands, and then feed it to RMAN all in one job run... Any thoughts would be very much appreciated.
In anything related to backup/restore of the database, I advise you to prefer OS's means to execute scheduled jobs (cron/at on unix, Scheduled tasks on Windows). The advantage is that they are independent from oracle instance and you can better handle cases when oracle instance is down or malfunctioning. The "RMAN pipe interface" is meant to be used together with operating system's shell, as well.
However, executing scripts directly from database is also possible: AskTom
If you want to use DBMS_SCHEDULER then the script has to reside on the database server.
But if you install an Oracle client on the web server you can run RMAN from there and connect to the TARGET database. E.g.:
rman 'usr/pwd#conn_str AS SYSDBA' CMDFILE /home/www/db/backup-full.rman
In this case the script can reside on the web server.
Hope this helps.