Leave a Comment:
15 comments
Dear Rupesh,
i am not understanding your point that you written
We can now copy the file safely.
then we drop the symbolic link:
rm /var/tmp/test_rm.dbf
ls -l /var/tmp/test_rm.dbf
ls: /var/tmp/test_rm.dbf: No such file or directory
and we can now copy the file
cp -p /proc/2661/fd/66 /var/tmp/test_rm.dbf
ls -l /var/tmp/test_rm.dbf
-rw-r—– 1 oracle dba 10493952 Mar 26 14:54 /var/tmp/test_rm.dbf
first you are saying that “copy the file and then remove the link” but actually you are removing the link first and copying the file later. Whats the operation that we have to perform first. For this you can tell me via email.
thanks and regards
adnan ali
Thanks for the comment.
Here my enlightenment confused you. What I said is after making tablespace readonly, we can safely copy the file.
SQL> alter tablespace TEST_RM read only;
Tablespace altered.
We can now copy the file safely.
That is a generic scentence, now bellow are the steps before coying the file.
we drop the symbolic link:
rm /var/tmp/test_rm.dbf
ls -l /var/tmp/test_rm.dbf
ls: /var/tmp/test_rm.dbf: No such file or directory
and we can now copy the file
cp -p /proc/2661/fd/66 /var/tmp/test_rm.dbf
ls -l /var/tmp/test_rm.dbf
-rw-r—– 1 oracle dba 10493952 Mar 26 14:54 /var/tmp/test_rm.dbf
And datafile is now available again.
Hope you got it .. ?
ReplyDear Rupesh
Thanks. Now i have got it. Really Nice work.
regards
adnan ali
this is really a good practice
but is there any way if db crashed while retreiving the datafile
When d/b is running in noarchive log mode
and no backup available.
Will the scenarios works if we delete the redo log file accidently or a control file
ReplyYes, but don’t you see Datafile is more important than the other files at this scenario ?
ReplyRupesh iam asking if the scenario works if a control file or a redo log file is deleted accidentally …
Thanks
Vaseem.
Hi Vaseem,
Here we are using one of the unix feature to recover deleted file, so this is applicable to control or redo file, if the process can continue to use its file handle, and the file can also be accessible under /proc//fd. But I haven’t tried it.
-Rupesh
ReplyReally good workaround if a control file is accidentally deleted it happens when we do a refresh —
Rupesh Good Job…
ReplyNice article rupesh.
I tested same thing with system tablespace, but you cannot put system tablespace in read only mode.
So I have copied system datafile directly from /proc//fd/ to the actual location, without symbolic link work.
It seems everything fine. what will be the impact, if we do same thing to any tablespace.
ReplyI’m unable to map the file descriptor with the deleted file name
ls -l /proc/_PID_OF_DBWRITER/fd | grep deleted
is there any other way to get the PID of the delete datafile ?
I did get the PID for dbw
ps -edf | grep dbw
then after I’m getting the PID for the deleted file ;there is no result