The query is a
CREATE TABLE t as SELECT .....;
statement. Can I reliably count on Oracle to complete this after I disconnect?
After I re-connect, how can I check on the status of this query?
Networkoracleoracle-sql-developer
The query is a
CREATE TABLE t as SELECT .....;
statement. Can I reliably count on Oracle to complete this after I disconnect?
After I re-connect, how can I check on the status of this query?
Best Answer
Most likely, it will finish a DDL command behind the scenes, but I wouldn't bet my job on it. What if your CTAS action runs out of tablespace? You would never see the error. If you have an unrealiable Internet connection, then the best solution is probably
Simple/basic solution
Way cooler Oracle Scheduler "nohup" solution.
But if you can't do that, or just want to do something cooler with Oracle, you could fire off your DDL inside a Scheduler Job in Oracle. This is basically like using NOHUP in Unix if you're familiar. You invoke
DBMS_SCHEDULER.CREATE_JOB
and then a job slave process will proceed on the Oracle server running as your same user to complete the work. When you submit the job, it will return immediately with no error or confirmation other than "Anonymous block completed.", which just means that you've queued up an asynchronous job. If you get disconnected, it won't matter. You can log back in and check the status of the job via theUSER_SCHEDULER_JOB_RUN_DETAILS
built-in view.I just did this in SQL Developer (note, user needs to have
CREATE JOB
privilege, and obviouslyCREATE TABLE
, too):...
...
Here's the status check. Note the status check says SUCCESS and error 0, so all good.
I ran the job again just for kicks and I got a FAILED with error 955 which is expected since the table
t
already exists.