File delete in 8i


Whilst UTL_FILE lets you read and write files, there seems to be no facility in version 8 of Oracle to remove a file from the database....well, maybe there is. Obviously RMAN needs some way of removing archive logs from the system once they have been backed up, so we can leverage this information to yield a solution

All you need to do is take a look at the DBMS_BACKUP_RESTORE package. Here is an example:

SQL> host ls /tmp/demo.dat
demo.dat
SQL> exec dbms_backup_restore.deletefile('/tmp/demo.dat')

PL/SQL procedure completed sucessfully.

SQL> host ls /tmp/demo.dat
/tmp/demo.dat: No such file of directory