Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

recover datafile - need help

Dev_SQLApr 2 2020 — edited Apr 2 2020

Dear All,

I've a few questions regarding "recover datafile filename/filenumber", I couldn't get the required details from Google, could you please shed some light on this?

Scenario #1

After renaming the data file manually at OS level and issuing "alter database rename file" statement, we run the below statement, to my knowledge, this will let the Control file to know the data file name change.

SQL> recover datafile '/u01/tbs01.dbf';

media recovery complete.

Scenario #2

In the Manual Hot Backup, not RMAN utility, I've copied the files from data and control folders to Backup folder, after issuing "begin backup" statement as shown below.

SQL>alter database begin backup;

$cp -r data control /disk1/hotbackup

SQL>alter database end backup;

After taking the backup, I have created a few new tables and now I've lost a data file and I've followed the below steps and recovered it.

a) alter database datafile '/disk1/prod/data/users01.dbf' offline;

b) Copy the lost 'users01.dbf' file from the backup folder to data folder.

c) recover datafile '/disk1/prod/data/users01.dbf'.

d) alter database datafile '/disk1/prod/data/users01.dbf' online;

Now, I have not only got my data file back, it also recovered the changes made after the backup was taken, that is I could see the new tables created after the "end backup" statement issued.

Could you please share more details about "recover datafile" in this context? How it actually managed to get the changes made after backup was taken, does it do the recovery from Redo log files related to this data file alone? Will it also use Archive Log files for recovery and how it identifies the Archive files to be used, based on the timestamp?

I've knowledge about Redo Log Buffer, Redo files and Archive Logs, their related background processes, if you could give some explanation on the above questions, that would help me to understand this clearly? Thank you so much!!

Comments
Post Details
Added on Apr 2 2020
1 comment
320 views