Search code examples
oracleamazon-rds

I want to cleanup up the DATA_PUMP_DIR on an RDS Oracle instance


I am porting an on-prim oracle database to AWS RDS Oracle. I am using the datapump method which involves downloading the dump file from S3 to the DATA_PUMP_DIR on the RDS oracle instance. I have all this working and I want to perform the same process again to refine and document, but when I try to download to the DATA_PUMP_DIR again the new dump file will not overwrite the old. I need a way to either overwrite or better yet, delete files from the DATA_PUMP_DIR. Any help would be appreciated.

SQL> SELECT * FROM TABLE(rdsadmin.rds_file_util.listdir('DATA_PUMP_DIR')) ORDER BY MTIME;

returns a list of files and my file exists in that list by when I execute:

results of listdir

SQL> EXEC UTL_FILE.FREMOVE('DATA_PUMP_DIR','frts-dev.dmp');

*
ERROR at line 1:
ORA-29283: invalid file operation: nonexistent file or path [29434]
ORA-06512: at "SYS.UTL_FILE", line 251
ORA-06512: at "SYS.UTL_FILE", line 1230
ORA-06512: at line 1

Solution

  • So yes, I had the file name wrong. so from sqlplus:

    SQL> EXEC UTL_FILE.FREMOVE('DATA_PUMP_DIR','frts_dev.dmp');

    works. Crazy how an extra set of eyes always helps. thanks guys.