extundelete就是用来恢复文件了,只要我们删除后的文件没有被覆盖就可以常用使用此工具来恢复了,下面来看个例子.
因为人员离职闹得不愉快,系统工程师离职后,由于公司未及时关闭其vpn,数据库服务器(Linux 6.5 Oracle 11.2.0.1)帐号未及时被修改,最后直接上去rm ORACLE_BASE给干掉,悲剧的是ORADATA目录也在里面,更加悲剧的是所有数据文件都在里面.也就是说数据库彻底被删除,而且没有任何备份.朋友咨询了我,让我给予支持.最后比较幸运,文件没有被覆盖,inode都还在,通过extundelete顺利恢复所有数据文件,控制文件,redo文件(extundelete恢复Linux被删除文件),数据库顺利打开,实现0丢失,算是一次完美的恢复,代码如下:
- [root@DB1tmp]#tarxvfextundelete-0.2.4.tar
- extundelete-0.2.4/
- extundelete-0.2.4/acinclude.m4
- extundelete-0.2.4/missing
- extundelete-0.2.4/autogen.sh
- extundelete-0.2.4/aclocal.m4
- extundelete-0.2.4/configure
- extundelete-0.2.4/LICENSE
- extundelete-0.2.4/README
- extundelete-0.2.4/install-sh
- extundelete-0.2.4/config.h.in
- extundelete-0.2.4/src/
- extundelete-0.2.4/src/extundelete.cc
- extundelete-0.2.4/src/block.h
- extundelete-0.2.4/src/kernel-jbd.h
- extundelete-0.2.4/src/insertionops.cc
- extundelete-0.2.4/src/block.c
- extundelete-0.2.4/src/cli.cc
- extundelete-0.2.4/src/extundelete-priv.h
- extundelete-0.2.4/src/extundelete.h
- extundelete-0.2.4/src/jfs_compat.h
- extundelete-0.2.4/src/Makefile.in
- extundelete-0.2.4/src/Makefile.am
- extundelete-0.2.4/configure.ac
- extundelete-0.2.4/depcomp
- extundelete-0.2.4/Makefile.in
- extundelete-0.2.4/Makefile.am
- [root@DB1tmp]#cdextundelete-0.2.4
- [root@DB1extundelete-0.2.4]#./configure
- Configuringextundelete0.2.4
- Writinggeneratedfilestodisk
- [root@DB1extundelete-0.2.4]#make&&makeinstall
- make-sall-recursive
- Makingallinsrc
- Makinginstallinsrc
- /usr/bin/install-cextundelete'/usr/local/bin'
- [root@DB1extundelete-0.2.4]#df-h
- FilesystemSizeUsedAvailUse%Mountedon
- /dev/sda3244G11G221G5%/
- tmpfs16G72K16G1%/dev/shm
- /dev/sda1190M62M119M35%/boot
- /dev/sdb12.0T71M1.9T1%/home
- [root@DB1extundelete-0.2.4]#umount/dev/sdb1
- umount:/home:deviceisbusy.
- (Insomecasesusefulinfoaboutprocessesthatuse
- thedeviceisfoundbylsof(8)orfuser(1))
- [root@DB1extundelete-0.2.4]#fuser-m-u/home
- /home:3914c(oracle)8372c(oracle)
- [root@DB1extundelete-0.2.4]#kill-93914
- [root@DB1extundelete-0.2.4]#fuser-m-u/home
- /home:8372c(oracle)
- [root@DB1extundelete-0.2.4]#kill-98372
- [root@DB1extundelete-0.2.4]#fuser-m-u/home
- [root@DB1extundelete-0.2.4]#umount/dev/sdb1
- [root@DB1extundelete-0.2.4]#df-h
- FilesystemSizeUsedAvailUse%Mountedon
- /dev/sda3244G11G221G5%/
- tmpfs16G72K16G1%/dev/shm
- /dev/sda1190M62M119M35%/boot
- [root@DB1extundelete-0.2.4]#extundelete/dev/sdb1--restore-all
- NOTICE:Extendedattributesarenotrestored.
- Loadingfilesystemmetadata...16384groupsloaded.
- Loadingjournaldescriptors...26542descriptorsloaded.
- Searchingforrecoverableinodesindirectory/...
- 18896recoverableinodesfound.
- Lookingthroughthedirectorystructurefordeletedfiles...
- 2recoverableinodesstilllost.
- Unabletorestoreinode43778050(file.43778050):Spacehasbeenreallocated.
- [root@DB1extundelete-0.2.4]#ls
- acinclude.m4autogen.shconfig.h.inconfig.statusconfigure.acinstall-shMakefileMakefile.in
- aclocal.m4config.hconfig.logconfiguredepcompLICENSEMakefile.ammissing
- [root@DB1extundelete-0.2.4]#cdRECOVERED_FILES/
- [root@DB1RECOVERED_FILES]#ls
- appfile.43778051oracleoraInventory
- [root@DB1RECOVERED_FILES]#cdapp
- [root@DB1app]#ls
- admincfgtoollogsdiagoracleoradataorclORCL
- [root@DB1app]#cdoradata//phpfensi.com
- [root@DB1oradata]#ls
- orcl
- [root@DB1oradata]#cdorcl
- [root@DB1orcl]#ls
- control01.ctlredo01.logredo02.logredo03.logsysaux01.dbfsystem01.dbfundotbs01.dbfusers01.dbf
- [root@DB1orcl]#ls-ltr
- total2908776
- -rw-r--r--.1rootroot734011392Nov1802:06system01.dbf
- -rw-r--r--.1rootroot1069555712Nov1802:06sysaux01.dbf
- -rw-r--r--.1rootroot120594432Nov1802:06undotbs01.dbf
- -rw-r--r--.1rootroot887365632Nov1802:06users01.dbf
- -rw-r--r--.1rootroot9748480Nov1802:06control01.ctl
- -rw-r--r--.1rootroot52429312Nov1802:06redo01.log
- -rw-r--r--.1rootroot52429312Nov1802:06redo02.log
- -rw-r--r--.1rootroot52429312Nov1802:06redo03.log
- [root@DB1orcl]#
再次提醒各位:数据库备份重于一切,防天灾的同时还要防人灾,也希望圈子里面以后不要听到类似故障.