Data Pump provides an interactive command mode that allows you to monitor the status of a Data Pump job and modify on the fly a number of job characteristics. The interactive command mode is most useful for long-running Data Pump operations. In this mode, you can also stop, restart, or terminate a currently running job. Each of these activities is discussed in the following post.
Entering Interactive Command Mode
There are two ways to access the interactive command mode prompt:
- Press Ctrl+C in a Data Pump job that you started via expdp or impdp.
- Use the ATTACH parameter to attach to a currently running job.
When you run a Data Pump job from the command line, you’re placed in the command-line mode. You should see output displayed to your terminal as a job progresses. If you want to exit command-line mode, press Ctrl+C. This places you in the interactive command-interface mode. For an export job, the prompt is
Export>
Type in the HELP command to view the export interactive commands available (see Table 8-1):
Export> help
Table 8-1. Export Interactive Commands
Command | Description |
---|---|
ADD_FILE | Adds files to the export dump set |
CONTINUE_CLIENT | Continues with interactive client mode |
EXIT_CLIENT | Exits the client session and returns to the OS prompt; leaves the current job running |
FILESIZE | Defines file size for any subsequently created dump files |
HELP | Displays interactive export commands |
KILL_JOB | Terminates the current job |
PARALLEL | Increases or decreases the degree of parallelism |
REUSE_DUMPFILES | Overwrites the dump file if it exists (default is N) |
START_JOB | Restarts the attached job |
STATUS | Displays the status of the currently attached job |
STOP_JOB [=IMMEDIATE] | Stops a job from processing (you can later restart it). Using the IMMEDIATE parameter quickly stops the job, but there may be some incomplete tasks. |
Type EXIT to leave interactive command mode:
Export> exit
You should now be at the OS prompt.
You can press Ctrl+C for either an export or an import job. For an import job the interactive command mode prompt is
Import>
To view all commands available, type HELP:
Import> help
The interactive command mode import commands are summarized in Table 8-2.
Table 8-2. Import Interactive Commands
Command | Description |
---|---|
CONTINUE_CLIENT | Continues with interactive logging mode |
EXIT_CLIENT | Exits the client session and returns to the OS prompt. Leaves the current job running |
HELP | Displays the available interactive commands |
KILL_JOB | Terminates the job currently connected to in the client |
PARALLEL | Increases or decreases the degree of parallelism |
START_JOB | Restarts a previously stopped job. START_JOB=SKIP_CURRENT restarts the job and skips any operations that were active when the job was stopped |
STATUS | Specifies the frequency at which the job status is monitored. Default mode is 0; the client reports job status changes whenever available in this mode. |
STOP_JOB [=IMMEDIATE] | Stops a job from processing (you can later restart it). Using the IMMEDIATE parameter quickly stops the job, but there may be some incomplete tasks. |
Type EXIT to leave the Data Pump status utility:
Import> exit
You should now be at the OS prompt.
Attaching to a Running Job
One powerful feature of Data Pump is that you can attach to a currently running job and view its progress and status. If you have DBA privileges, you can even attach to a job if you aren’t the owner. You can attach to either an import or an export job via the ATTACH parameter.
Before you attach to a job, you must first determine the Data Pump job name (and owner name, if you’re not the owner of the job). Run the following SQL query to display currently running jobs:
SQL> select owner_name, operation, job_name, state from dba_datapump_jobs;
Here is some sample output:
OWNER_NAME OPERATION JOB_NAME STATE
---------- --------------- -------------------- --------------------
MV_MAINT EXPORT SYS_EXPORT_SCHEMA_01 EXECUTING
In this example the MV_MAINT user can directly attach to the export job, as shown:
$ expdp mv_maint/foo attach=sys_export_schema_01
If you aren’t the owner of the job, you attach to the job by specifying the owner name and the job name:
$ expdp system/foobar attach=mv_maint.sys_export_schema_01
You should now see the Data Pump command-line prompt:
Export>
Type STATUS to view the status of the currently attached job:
Export> status
If you have a currently running Data Pump job that you want to temporarily stop, you can do so by first attaching to the interactive command mode. You may want to stop a job to resolve space issues or performance issues and then, after resolving the issues, restart the job. This example attaches to an import job:
$ impdp mv_maint/foo attach=sys_import_table_01
Now, stop the job, using the STOP_JOB parameter:
Import> stop_job
You should see this output:
Are you sure you wish to stop this job ([yes]/no):
Type YES to proceed with stopping the job. You can also specify that the job be stopped immediately:
Import> stop_job=immediate
When you stop a job with the IMMEDIATE option, there may be some incomplete tasks associated with the job. To restart a job, attach to interactive command mode, and issue the START_JOB command:
Import> start_job
If you want to resume logging job output to your terminal, issue the CONTINUE_CLIENT command:
Import> continue_client
You can instruct Data Pump to permanently kill an export or import job. First, attach to the job in interactive command mode, and then issue the KILL_JOB command:
Import> kill_job
You should be prompted with the following output:
Are you sure you wish to stop this job ([yes]/no):
Type YES to permanently kill the job. Data Pump unceremoniously kills the job and drops the associated status table from the user running the export or import.