Linux下使用lsof恢復刪除的檔案
使用lsof刪除恢復的檔案
模擬lsof恢復刪除的檔案(tools.dbf):
Solaris 9 + lsof 4.77 + oracle 8.1.7
1. 資料檔案由dbwr程式開啟。
bash-2.05# ps -ef | grep ora_ | grep 817 (其中test表示sid)
oracle 817 1 0 15:56:30 ? 0:00 ora_pmon_test817
oracle 819 1 0 15:56:30 ? 0:00 ora_dbw0_test817
oracle 821 1 0 15:56:30 ? 0:00 ora_lgwr_test817
oracle 823 1 0 15:56:30 ? 0:00 ora_ckpt_test817
oracle 825 1 0 15:56:31 ? 0:01 ora_smon_test817
oracle 827 1 0 15:56:31 ? 0:00 ora_reco_test817
oracle 829 1 0 15:56:31 ? 0:00 ora_snp0_test817
oracle 831 1 0 15:56:31 ? 0:00 ora_snp1_test817
oracle 833 1 0 15:56:31 ? 0:00 ora_snp2_test817
oracle 835 1 0 15:56:31 ? 0:00 ora_snp3_test817
oracle 837 1 0 15:56:31 ? 0:00 ora_s000_test817
oracle 839 1 0 15:56:31 ? 0:00 ora_d000_test817
oracle 841 1 0 15:56:31 ? 0:00 ora_arc0_test817
2. 列出dbwr程式開啟的資料檔案
bash-2.05# lsof -a -p 819 -d ^txt | egrep "COMMAND|dbf"
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
oracle 819 oracle *200uW VREG 32,4 10493952 22545 /u01/oracle/oradata/test817/garychen01.dbf
oracle 819 oracle *201uW VREG 32,4 104865792 22544 /u01/oracle/oradata/test817/test01.dbf
oracle 819 oracle *202uW VREG 32,4 88088576 22563 /u01/oracle/oradata/test817/drsys01.dbf
oracle 819 oracle *203uW VREG 32,4 56631296 22560 /u01/oracle/oradata/test817/indx01.dbf
oracle 819 oracle *204uW VREG 32,4 109060096 22559 /u01/oracle/oradata/test817/users01.dbf
oracle 819 oracle *205uW VREG 32,4 71311360 22558 /u01/oracle/oradata/test817/temp01.dbf
oracle 819 oracle *206uW VREG 32,4 541073408 22557 /u01/oracle/oradata/test817/rbs01.dbf
oracle 819 oracle *207uW VREG 32,4 8396800 22556 /u01/oracle/oradata/test817/tools01.dbf
oracle 819 oracle *208uW VREG 32,4 283123712 22555 /u01/oracle/oradata/test817/system01.dbf
3.刪除tools.dbf資料檔案
bash-2.05# rm /u01/oracle/oradata/test817/tools01.dbf
4. 在 Solaris 中,刪除的檔案將顯示檔案所在的磁碟的名稱
bash-2.05# lsof -a -p 819 -d ^txt
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
oracle 819 oracle cwd VDIR 32,11 512 158092 /u03/oracle/product/8.1.7/dbs
oracle 819 oracle 0r VCHR 13,2 0t0 281623 /devices/pseudo/mm@0:null
oracle 819 oracle 1r VCHR 13,2 0t0 281623 /devices/pseudo/mm@0:null
oracle 819 oracle 2r VCHR 13,2 0t0 281623 /devices/pseudo/mm@0:null
oracle 819 oracle 3r VCHR 13,2 0t0 281623 /devices/pseudo/mm@0:null
oracle 819 oracle 4r VCHR 13,2 0t0 281623 /devices/pseudo/mm@0:null
oracle 819 oracle 5r VCHR 13,2 0t0 281623 /devices/pseudo/mm@0:null
oracle 819 oracle 6w VREG 32,11 43794 171624 /u03/oracle/admin/test817/bdump/alert_test817.log
oracle 819 oracle 7r VCHR 24,3 0t0 281702 /devices/pseudo/pts@0:3->ttcompat->ldterm->ptem->pts
oracle 819 oracle 8w VREG 32,11 43794 171624 /u03/oracle/admin/test817/bdump/alert_test817.log
oracle 819 oracle 9r DOOR 268,0 0t0 58 /var/run (swap) (door to nscd[269])
oracle 819 oracle 10r VREG 32,11 358912 84962 /u03/oracle/product/8.1.7/rdbms/mesg/oraus.msb
oracle 819 oracle 11u VREG 32,11 1124 171764 /u03/oracle/product/8.1.7/rdbms/audit/ora_815.aud
oracle 819 oracle 12uR VREG 32,11 24 158548 /u03/oracle/product/8.1.7/dbs/lkTEST817
oracle 819 oracle *200uW VREG 32,4 10493952 22545 /u01/oracle/oradata/test817/garychen01.dbf
oracle 819 oracle *201uW VREG 32,4 104865792 22544 /u01/oracle/oradata/test817/test01.dbf
oracle 819 oracle *202uW VREG 32,4 88088576 22563 /u01/oracle/oradata/test817/drsys01.dbf
oracle 819 oracle *203uW VREG 32,4 56631296 22560 /u01/oracle/oradata/test817/indx01.dbf
oracle 819 oracle *204uW VREG 32,4 109060096 22559 /u01/oracle/oradata/test817/users01.dbf
oracle 819 oracle *205uW VREG 32,4 71311360 22558 /u01/oracle/oradata/test817/temp01.dbf
oracle 819 oracle *206uW VREG 32,4 541073408 22557 /u01/oracle/oradata/test817/rbs01.dbf
oracle 819 oracle *207uW VREG 32,4 8396800 22556 /u01 (/dev/dsk/c1t0d0s4)
oracle 819 oracle *208uW VREG 32,4 283123712 22555 /u01/oracle/oradata/test817/system01.dbf
oracle 819 oracle *209u VREG 32,4 4431872 22551 /u01/oracle/oradata/test817/control03.ctl
oracle 819 oracle *210u VREG 32,4 4431872 22550 /u01/oracle/oradata/test817/control02.ctl
oracle 819 oracle *211u VREG 32,4 4431872 22549 /u01/oracle/oradata/test817/control01.ctl
5.檢視/proc檔案系統
Cd /proc/819/fd/ 就可以得到所要查詢的資料
bash-2.05# ls /proc/819/fd/*207
/proc/819/fd/26207
cat /proc/819/fd/26207 > /u01/oracle/oradata/test817/tools01.dbf
chown oracle:dba /u01/oracle/oradata/test817/tools01.dbf
6. 驗證檔案已經恢復了。
Sqlplus> alter system checkpoint;
參考:
http://www.ibm.com/developerworks/cn/aix/library/au-lsof.html#listing2
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-434664/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux下用rm刪除的檔案的恢復方法Linux
- linux下恢復誤刪除oracle的資料檔案LinuxOracle
- Oracle 檔案意外刪除恢復(Linux)OracleLinux
- linux系統下檔案誤刪除該如何恢復?Linux
- Git恢復刪除的檔案Git
- 如何使用 testdisk 恢復已刪除的檔案
- Linux下面誤刪除檔案使用extundelete工具恢復介紹Linuxdelete
- 恢復EXT3下被刪除的檔案
- 行動硬碟刪除的檔案能恢復嗎,怎麼恢復硬碟刪除的檔案硬碟
- sd卡刪除的檔案如何恢復SD卡
- Shift + Delete刪除的檔案如何恢復?delete
- 360粉碎檔案可以恢復嗎,如何恢復360強力刪除的檔案
- Linux 恢復rm -rf命令所刪除的達夢資料檔案Linux
- 隨身碟被刪除的檔案如何恢復?
- 回收站刪除的檔案怎麼恢復?
- 被360防毒刪除的檔案怎麼恢復防毒
- rm -rf 刪除檔案還能恢復嗎?
- Linux系統中檔案被刪除後的恢復方法(ext4)Linux
- linux-ext4格式檔案誤刪除,該如何恢復?Linux
- win10 shift delete刪除的檔案如何恢復Win10delete
- 電腦裡刪除的檔案怎麼恢復,資料恢復方法大全資料恢復
- U盤的東西刪除了怎麼恢復,怎麼恢復U盤刪除的檔案
- sd卡中的資料夾刪除了怎麼恢復,SD卡刪除的檔案如何恢復SD卡
- 回收站刪除的檔案恢復,保姆級教學
- 【伺服器資料恢復】Zfs檔案系統下誤刪除怎麼恢復資料伺服器資料恢復
- 【伺服器資料恢復】linux ext3檔案系統下誤刪除mysql資料庫的資料恢復案例伺服器資料恢復LinuxMySql資料庫
- eclipse 恢復誤刪檔案Eclipse
- 如何恢復被刪除的 GitLab 專案?Gitlab
- Linuxt恢復誤刪內容:命令lsof、extundelete工具Linuxdelete
- win10怎麼找回shift delete刪除的檔案_win10按shiftdelete刪除的檔案如何恢復Win10delete
- 回收站的東西怎麼恢復?回收站刪除的檔案恢復教程
- oracle使用小記、刪除恢復Oracle
- LINUX 使用批量刪除檔案的幾種方法Linux
- Linux批量刪除檔案Linux
- Linux刪除檔案命令Linux
- win10 回收站刪除的檔案怎麼恢復Win10
- 刪除的PSD檔案在哪可以恢復?一定要看看
- 【Linux】linux下刪除/清空資料夾/檔案命令Linux
- win10推送檔案被刪除怎麼恢復_win10推送檔案已被刪除如何找回Win10