Oracle 10g - Run a job that executes a batch file in local disk - oracle

I'm trying to run a .bat file after my stored procedure has done running. The purpose of the batch file is to create logs based on the code in the stored procedure. But I don't know how to run a .bat or even an exe file using PL/SQL Oracle.

The oracle scheduler can execute OS programs (on the DB server), and you can create a scheduled jobs from pl/SQL.
Look at the documentation of DBMS_SCHEDULER package - http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_sched.htm#i1000363

Related

Flyway windows command line gives no output, at all

I have been using flyway for a while and have managed to successfully execute migrations. This past week or so whenever I try and use flyway the command executes successfully but I get no output at all!
This is not such a big issue for the migrate command, I can just go and check in the database what has been done from the flyway_schema_history table. It is quite frustrating when using the info command however. Previously I'd used this to sort of pre-view what was about to happen.
I've tried running the command in as many ways as I can think of.
I've now tried three versions of flyway too!
I am currently using flyway-9.7.0 on a windows 10 computer. I am trying to execute my migration scripts on an Oracle 19C database.
I am executing these commands:
flyway migrate -url=jdbc:oracle:thin:#//<URL>:<PORT>/<DB_NAME> -user=<DB_USER> -password=<Password>
-locations=filesystem:C:\flyway-9.7.0\migrations -outputFile=C:\flyway-9.7.0\migrations\out.log
flyway info -url=jdbc:oracle:thin:#//<URL>:<PORT>/<DB_NAME> -user=<DB_USER> -password=<Password>
-outputFile=C:\flyway-9.7.0\migrations\out.log
Both of these commands execute successfully (apparently).
For the "migrate" command the database objects are created in the database, an entry is added to the schemas flyway_schema_history table and a log file is created as specified (but is empty)
For the "info" command the log file is again created (empty)
I get nothing written to the windows CMD window that I am executing the command in however!
Please, what can I do to see some feedback from my commands?

How to handle the execution of a set of scripts in SQLDeveloper

Sometimes I have to apply this kind of sql script that has in another folder more scripts:
PROMPT "--------------------------------------"
PROMPT " APLICANDO Edward"
PROMPT "--------------------------------------"
#./Packages/Edward.sql
#./Packages/Edward2.sql
.
.
.
prompt "------------------------------------------------------"
prompt " FIN DE APLICA Edward"
prompt "------------------------------------------------------"
Usually I had to put that .zip file on the server and execute it in sqlplus, but I don't know if could execute them in SQLDeveloper (in a windows environment). Is there some way to do it in that tool?
If you are not running the scripts using SQL Developer in production, I would not recommend using SQL Developer to test the scripts. You always want your testing to be as close as possible to production.
You had said that SQLPlus will be used run the scripts in production, so I would recommend installing the same version of SQLPlus on your machine to test out the scripts. Running scripts from SQL Developer runs them using SQLcl so the behavior could be slightly different than SQLPlus. Oracle says SQLcl it is 99% compatible with SQLPlus, but without knowing what is in your scripts and what version of SQLPlus/SQLcl/SQL Developer you are using, we can not know for sure.
If you are determined on running your scripts from SQL Developer, in a SQL Worksheet, you just need to change directories to where your scripts live, then execute them just like you would from the command line. If you are on an older version of SQL Developer (pre-SQLcl) this may not work so you will need to upgrade your version of SQL Developer.

Batch Script for deployment in oracle weblogic sever 11g

Can anyone please share the sample batch script code for deploying ear file to a oracle weblogic server 11g?
This can't be achieved using shell script alone. A shell script in conjunction with WLST to be used to achieve this. In Shell script setup WLST environment and invoke WLST script. Please have a look at below answer for sample WLST script.
https://stackoverflow.com/questions/41601680/wldeploy-on-all-files-in-deployment-folder/41621500#41621500

how to schedule a job on Oracle SQL developer to execute shell command "Java -Jar /Home/JavaFile.jar" each one minute?

I would like to create an oracle job that runs every one minute to run command Java -jar /Home/file_name.jar", i am using Oracle SQL developer on windows environment to connect to Oracle DB on Linux environment.
step 1 you need to first load this java program in oracle so that it can run on jvm installed in oracle database...
ref link http://docs.oracle.com/cd/B19306_01/java.102/b14187/chthree.htm
step 2 then you need to create function or procedure to run this java program say
CREATE OR REPLACE FUNCTION helloworld RETURN VARCHAR2 AS
LANGUAGE JAVA NAME 'Hello.world () return java.lang.String';
step 3 then you need to create job or scheduler in oracle to run this oracle function it will internally call your java method.
follow the link to create job
http://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse.htm#ADMIN12381
I found a very simple way as below:
1- Connect on linux server using Putty or anything.
2-run command crontab -e
3-edit crontab by clicking i then type java command ex: * * * * * java -jar /root/filename.jar and this means that this jar file will be called each one minutes

Bash script to write Log Processing output to remote DB2

I have a bash script running on a server to capture and process the Logs.
The script is invoked by an utility for processing the Logs. After processing the Logs the
state of the Logs should be stored in db2 table located in some other server.
say, if i have shell script on 110.88.99.10 and db2 on 110.88.99.11..
I need save the processed result to db2.. Any suggestions?
It seems that you need to install the DB2 client: IBM data server access. Once you have installed, you configure the remote instance and database (catalog TCPIP Node and catalog database), and then you can integrate db2 commands (db2 insert ... - log result) in your script.

Resources