This is a very obscure one liner to kill a running an Oracle expdp job.
Background:
- The expdp/impdp is the Oracle data pump tools to export and import data
- Killing the expdp process is not enough to stop an export job
- To kill an export, you will have to “expdp attach=JOB_NAME” and issue a “KILL_JOB” command
Pre requisites for my one liner:
- You have a log file in the current directory called exp_something.log (by using the LOGFILE=exp_something.log in your parameter file)
Here comes the one-liner which works in ksh:
expdp attach=$(grep Starting $(ls -tr exp*.log | tail -1) | cut -d":" -f 1 | cut -d"." -f 2 | sed -e 's/"//g')<$(printf "/ as sysdbanKILL_JOBnyesn">/tmp/someFile$(echo /tmp/someFile)
That’s it! If the expdp job exits with an exit code > 0 (echo $?), it failed. Just run the one liner again. The output of the one liner will hang for some seconds at the question “are you really really sure: [yes]/no:”, which is normal. Just wait.
Over and out!