Thursday, December 25, 2014

How to kill datapump job


We have several method to kill the running datapump job in oracle.

1. When the datapump (expdp or impdp) job is still running :-

  execute control+c , it will show you export or import prompt.

  Export>

 then execute kill_job on the prompt it will ask for the conformation to kill the job or not.
 example :-

 Export >kill_job
 Are you sure you wish to stop this job ([yes]/no): yes

2. If by mistake you are out of import or export prompt then

    a) Get the name of the job using

         select * from dba_datapump_jobs;

    b) Open a new command prompt window. If you want to kill your import job type

         impdp username/password@database attach=name_of_the_job   (Get the name_of_the_job using the above query)

    c) Once you are attached to job, Type Kill_Job

     Ex: Import>kill_job
            Are you sure you wish to stop this job (y/n): y
            And your job is killed, it will no longer show in dba_datapump_jobs

 3. using sql package :-
      To kill datapump job, we need two parameter as input to SQL package are: JOB_NAME of the datapump job & OWNER_NAME who initiated export.

SQL> DECLARE
           h1 NUMBER;
      BEGIN
           h1:=DBMS_DATAPUMP.ATTACH(‘SYS_EXPORT_FULL_01‘,’SYSTEM‘);
           DBMS_DATAPUMP.STOP_JOB (h1, 1, 0);
       END;
PL/SQL procedure successfully completed.

No comments:

Post a Comment

Followers