Tuesday, January 10, 2017

Recovering a deleted datafile using lsof

# rm -f /opt/oracle/LAB/datafile/o1_mf_users_d1mb8zg9_.dbf

# /usr/sbin/lsof | grep dbf
oracle     3545    oracle  261uW     REG     253,10  524296192     491528 /opt/oracle/LAB/datafile/o1_mf_users_d1mb8zg9_.dbf (deleted)
oracle     3547    oracle  264u      REG       253,10  524296192     491528 /opt/oracle/LAB/datafile/o1_mf_users_d1mb8zg9_.dbf (deleted)
oracle     3551    oracle  260u      REG       253,10  524296192     491528 /opt/oracle/LAB/datafile/o1_mf_users_d1mb8zg9_.dbf (deleted)

# ls -l /proc/3545/fd/261
lrwx------ 1 oracle oinstall 64 Jan  4 11:16 /proc/3545/fd/261 -> /opt/oracle/LAB/datafile/o1_mf_users_d1mb8zg9_.dbf (deleted)

# dd if=/proc/3545/fd/261 of=/opt/oracle/LAB/datafile/o1_mf_users_d1mb8zg9_.dbf
1024016+0 records in
1024016+0 records out
524296192 bytes (524 MB) copied, 5.49037 seconds, 95.5 MB/s

No comments:

Post a Comment