Continue running SQL procedure when SQL Developer is Closed - oracle

Is there any way to execute a procedure in SQL Developer and have the procedure continue to run even in SQL Developer is closed?

Yes, here's an Oracle doc that will guide you through defining a scheduler job. You can use this method (or DBMS_SCHEDULER, or OEM) to schedule a job that will execute a procedure without needing to maintain database connectivity.
Would recommend reading the entire doc, but you can skip ahead to "Schedule SQL Scripts Using SQL Developer" to view the relevant info.
https://docs.oracle.com/database/sql-developer-17.2/DMRIG/generating-deploying-sql-scripts.htm#DMRIG260

Related

PL/SQL from Oracle SQL Developer connecting to DB2

I have successfully connected to a DB2 database from Oracle SQL Developer 19.4.0.354 using the DB2 ODBC driver.
SQl scripts work just fine.
Now I also want to execute PL/SQL scripts but simple sample script fails.:
set serveroutput on
DECLARE
message varchar2(20):= 'Hello, World!';
BEGIN
dbms_output.put_line(message);
END;
It fails in such a way that PL/SQL code does not seem to be accepted at all:
DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=DECLARE
message varchar2(20):= 'Hell;BEGIN-OF-STATEMENT;<create_view>, DRIVER=4.26.14
Is PL/SQL generally supported in this setup?
When using the Oracle-compatibility mode of Db2-LUW, it is necessary to:
set the Db2-registry-variable DB2_COMPATIBILITY=ORA with the db2set command.
bounce the Db2-instance with the db2stop and db2start commands, so the registry variable becomes effective.
create a new database after both of the above steps are completed (using the db2 create database command ), so that Oracle specific datatypes and other features become available.
If you only change the registry variable and bounce the Db2-instance but use a pre-existing database then you will not get all of the implemented Oracle compatibility features! This is documented in the Db2-Knowledge-Centre online.
With currently shipping Db2-LUW versions, you cannot retrofit the Oracle compatibility on to a previously created database.

How to copy a JOB, PROGRAM, SCHEDULE definition to run it in another Oracle 11g DB?

I need to copy some Jobs, Schedules and Programs from an Oracle 11g DB to another one, but when I try to look for the SQL of the Job/Schedule/Program on SQL Developer 4.1.3, the SQL tab shows nothing on Edit mode.
When I open a table and I click on the SQL tab, the SQL for create the table is showed up. I was expecting a similar behavior for a Job/Schedule/Program.
How can I copy a JOB/PROGRAM/SCHEDULE definition to run it in another Oracle 11g DB?
The easiest way for Jobs is to use DBMS_METADATA:
select dbms_metadata.get_ddl('PROCOBJ', job_name)
from user_scheduler_jobs;
I'm not 100% sure about schedules / programs, though.
I think you can also use expdp utility and use include=PROCOBJ. All schedules are objects type PROCOBJ. The you should have all jobs which are owned by schema you are exporting. (If you want DDL you can use impdp with sqlfile= to write dump into SQL file. Or use method suggested by Frank Schmitt)
Unfortunately I think if you use this method or method suggested by Frank Schmitt I think you won't be able to get schedules owned by SYS.

PL/SQL Developer: disconnect, yet allow the query to continue

Using PL/SQL Developer by AllRound Automations, is there a way, during a long-running query, to disconnect yet allow the query to continue to completion, when running on an Oracle database?
Dmitry says:
It is impossible. You can try to kill process of PLSQL Developer using
windows task manager. Sometimes session stays active, but nobody
guarantees the result

How do I set the SDE version in SSIS dataflow source

I have a GIS oracle database and I am needing to reference in a SSIS dataflow task. Ideally I would normally do something like this (which works perfectly in Oracle SQL Developer):
execute sde.version_util.set_current_version('SAFE.mvedits')
SELECT CAD_EVENTID
FROM SAFE.INCIDENT_POINT_MV
however when I try to use that as the SQL command of my OLE DB Datasource it throws me an "Invalid SQL" error.
How do I set the SDE version in a SSIS dataflow task data source?
Knowing nothing of nothing on Oracle, what you might try is
In your Oracle Connection Manager, change the property RetainSameConnection to True. This means that all connections will Oracle will use the same thread.
Add an Execute SQL Task before your Data Flow that talks to Oracle. Use your query there to modify the current version thing. This setting should be persisted on the connection.
In your OLE DB Datasource, start with the SELECT statement.
You might need to set DelayValidation to true as well.
If that's not working, let me know and I'll see if I can come up with anything else.
As it turns out this is a shortfall of interacting with GIS Oracle databases through thirdparty applications. In my situation we addressed it by just bundling the change up in a stored procedure that lives on the oracle server and invoking that stored procedure from inside SSIS.

Invoke oracle stored procedure from shell script without SQLPLUS

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

Resources