Not all of the orphans are datafiles.
Rodger Schell, July 22, 2016 - 10:34 pm UTC
The problem with this approach is that not all of the orphaned files are datafiles, currently I see:
ARCHIVELOG
ASMPARAMETERFILE
AUTOBACKUP
BACKUPSET
CHANGETRACKING
CONTROLFILE
DATAFILE
DATAGUARDCONFIG
DUMPSET
OCRFILE
ONLINELOG
PARAMETERFILE
TEMPFILE
Admittedly, some of these can be determined by querying other tables, but I don't know a way of resolving several of these file types.
July 25, 2016 - 8:41 am UTC
Not all those directories contain things that are managed by the database! For example, DUMPSET (should) only contain data pump export/import files. Only you can state whether these are "orphans".
If you're using RMAN, you should be able to use this to see which backups, archivelogs, etc. are still registered.
There's various other *file views which may help:
v$controlfile
v$tempfile
But you're going to have to do some manual work figuring out what's needed and what's not. Unless you can rebuild the whole thing from scratch...