Restore and recover of a lost datafile in a PDB is failing with the following:
##### Exceuting Tablespace offline script for partial restore #####
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 27 13:48:24 2025
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
SQL>SQL>SQL>SQL>Connected.
SQL>SQL>SQL>SQL>SQL>SQL>SQL>SQL>SQL>SQL>SQL>SQL>SQL>alter database datafile 105 offline
*
ERROR at line 1:
ORA-01516: nonexistent log file, data file, or temporary file "xxx" in the current container
SQL> 1* alter database datafile xxx offline
SQL>SQL>Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
##### End Exceuting Tablespace offline script #####
Solution:
Online and offline commands must be execute from the same container in which datafile resides as v$datafile and dba_data_files only have the entries of the datafiles belonging to that container.
- Connect to the PDB in question and bring the datafile offline
- Uncheck the option to Switch tablespace for restore
- run the restore
- Bring datafile online after the restore