To delete a single file from DATA_PUMP_DIR, we need to first know the name of the file.
The below statement can be used to list down all the files avialable in the DATA_PUMP_DIR
Now, copy the filename which you want to delete and use below command to delete it
We can modify the select statement to filter for only the files to be deleted for example to meet a specific criteria like .log or .dmp etc.
The below statement can be used to list down all the files avialable in the DATA_PUMP_DIR
select * from DBMS_CLOUD.LIST_FILES('DATA_PUMP_DIR');
Now, copy the filename which you want to delete and use below command to delete it
BEGIN
UTL_FILE.FREMOVE('DATA_PUMP_DIR','FILE_NAME');
COMMIT;
END:
/
There can be a case where you want to delete all the files from the DATA_PUMP_DIR or any other directory defined in Oracle Database / ADB. Use the below to delete all files in one shot.
BEGIN
FOR r IN (SELECT object_name FROM DBMS_CLOUD.LIST_FILES('DATA_PUMP_DIR'))
LOOP
UTL_FILE.FREMOVE ('DATA_PUMP_DIR',r.object_name );
END LOOP;
COMMIT;
END;
/
We can modify the select statement to filter for only the files to be deleted for example to meet a specific criteria like .log or .dmp etc.
good one! thanks!
ReplyDeleteThanks
ReplyDeleteThank You and I have a keen supply: Where Is Charlotte Church House Renovation cost to gut renovate a house
ReplyDelete