RMAN-06509
When we tried to restore a datafile from a backup piece in RMAN, we saw error RMAN-06509.
RMAN> restore datafile 1 from '/home/oracle/datafile-0a1r6qon_1_1';
...
RMAN-06509: only SPFILE or control file can be restored from AUTOBACKUP
RMAN-06509 means that only SPFILE and control file can be restored directly from a backup piece, we should find another way around to restore data files. In fact, the backup piece is not necessarily an AUTOBACKUP, which may lead you to a wrong direction.
Solution
If you really like to restore data files from a specific backup piece, please use FROM TAG, but first of all, you have to know its tag name.
List Backup of Datafile
RMAN> list backup of datafile 1;
...
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
83 Full 783.16M DISK 00:00:05 03-MAY-23
BP Key: 83 Status: AVAILABLE Compressed: NO Tag: BEFORE_FLASHCOPY
Piece Name: /home/oracle/datafile-0a1r6qon_1_1
List of Datafiles in backup set 83
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- --------- ----------- ------ ----
1 Full 2536021 03-MAY-23 NO /u01/app/oracle/oradata/ORCLCDB/system01.dbf
Restore Datafile from Tag
Then we use the tag name found in the above list to restore it.
RMAN> restore datafile 1 from tag 'BEFORE_FLASHCOPY';
This is the only way to use FROM keyword to restore data files in RMAN.
To check all content of the backup piece exactly, we have some way to do it.