Here below a sample RMAN job command code to recover from loss of datafile without backup from archivelogs and online redologs.
If the SQL statement has a file name with path, then use double quotes to enclose the statement, and two individual single quotes before and after the datafile name and path.
RMAN > RUN { SQL "ALTER DATABASE DATAFILE ''D:\DUP\ORADATA\NEWTBS.dbf'' OFFLINE"; SQL "ALTER DATABASE CREATE DATAFILE ''D:\DUP\ORADATA\NEWTBS.dbf'' "; --This will recover from archivelogs and and online redologs RECOVER DATAFILE 'D:\DUP\ORADATA\NEWTBS.dbf'; SQL "ALTER DATABASE DATAFILE ''D:\DUP\ORADATA\NEWTBS.dbf'' ONLINE"; }
meda Edited answer 06/03/2022