linux下误删数据文件恢复

linux下文件被删除可以用很多工具进行恢复,例如undelete(适合ext2,ext3)、giis(不能恢复安装giis之前的文件)、ext3grep(仅限ext3)、R-linux(支持ext3,但是需要操作系统是32位的)。还有testdisk等等就不一一介绍了。需要注意的是,我们误删文件后,最好保持现场。

下面不用工具来恢复误删的数据文件:

[email protected]>select * from zbdba;
select * from zbdba
              *
ERROR at line 1:
ORA-01116: error in opening database file 6
ORA-01110: data file 6: '/opt/oracle/oradata/orcl11g/zbdba01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

[[email protected] ~]# ps -ef |grep dbw
oracle    4884     1  0 22:31 ?        00:00:00 ora_dbw0_orcl11g
root      5083  5063  0 22:35 pts/3    00:00:00 grep dbw
[[email protected] ~]# lsof 4884

[[email protected] ~]# lsof -p 4884
COMMAND  PID   USER   FD   TYPE DEVICE  SIZE/OFF    NODE NAME
oracle  4884 oracle  cwd    DIR  253,0      4096 1311097 /opt/oracle/products/11.2.0/dbs
oracle  4884 oracle  rtd    DIR  253,0      4096       2 /
oracle  4884 oracle  txt    REG  253,0 210823828 1715825 /opt/oracle/products/11.2.0/bin/oracle
oracle  4884 oracle  mem    REG   0,16   4194304   30646 /dev/shm/ora_orcl11g_688128_0
oracle  4884 oracle  mem    REG   0,16   4194304   30647 /dev/shm/ora_orcl11g_688128_1
oracle  4884 oracle  mem    REG   0,16         0   30648 /dev/shm/ora_orcl11g_688128_2
oracle  4884 oracle  mem    REG   0,16         0   30649 /dev/shm/ora_orcl11g_688128_3
oracle  4884 oracle  mem    REG   0,16         0   30650 /dev/shm/ora_orcl11g_688128_4
oracle  4884 oracle  mem    REG   0,16         0   30651 /dev/shm/ora_orcl11g_688128_5
oracle  4884 oracle  mem    REG   0,16         0   30652 /dev/shm/ora_orcl11g_688128_6
oracle  4884 oracle  mem    REG   0,16         0   30653 /dev/shm/ora_orcl11g_688128_7
oracle  4884 oracle  mem    REG   0,16         0   30654 /dev/shm/ora_orcl11g_688128_8
oracle  4884 oracle  mem    REG   0,16         0   30655 /dev/shm/ora_orcl11g_688128_9
oracle  4884 oracle  mem    REG   0,16         0   30656 /dev/shm/ora_orcl11g_688128_10
oracle  4884 oracle  mem    REG   0,16         0   30657 /dev/shm/ora_orcl11g_688128_11
oracle  4884 oracle  mem    REG   0,16         0   30658 /dev/shm/ora_orcl11g_688128_12
oracle  4884 oracle  mem    REG   0,16         0   30659 /dev/shm/ora_orcl11g_688128_13
oracle  4884 oracle  mem    REG   0,16         0   30660 /dev/shm/ora_orcl11g_688128_14
oracle  4884 oracle  mem    REG   0,16         0   30661 /dev/shm/ora_orcl11g_688128_15
oracle  4884 oracle  mem    REG   0,16         0   30662 /dev/shm/ora_orcl11g_688128_16
oracle  4884 oracle  mem    REG   0,16         0   30663 /dev/shm/ora_orcl11g_688128_17
oracle  4884 oracle  mem    REG   0,16         0   30664 /dev/shm/ora_orcl11g_688128_18
oracle  4884 oracle  mem    REG   0,16         0   30665 /dev/shm/ora_orcl11g_688128_19
oracle  4884 oracle  mem    REG   0,16         0   30666 /dev/shm/ora_orcl11g_688128_20
oracle  4884 oracle  mem    REG   0,16         0   30667 /dev/shm/ora_orcl11g_688128_21
oracle  4884 oracle  mem    REG   0,16         0   30668 /dev/shm/ora_orcl11g_688128_22
oracle  4884 oracle  mem    REG   0,16         0   30669 /dev/shm/ora_orcl11g_688128_23
oracle  4884 oracle  mem    REG   0,16         0   30670 /dev/shm/ora_orcl11g_688128_24
oracle  4884 oracle  mem    REG   0,16         0   30671 /dev/shm/ora_orcl11g_688128_25
oracle  4884 oracle  mem    REG   0,16         0   30672 /dev/shm/ora_orcl11g_688128_26
oracle  4884 oracle  mem    REG   0,16         0   30673 /dev/shm/ora_orcl11g_688128_27
oracle  4884 oracle  mem    REG   0,16         0   30674 /dev/shm/ora_orcl11g_688128_28
oracle  4884 oracle  mem    REG   0,16         0   30675 /dev/shm/ora_orcl11g_688128_29
oracle  4884 oracle  mem    REG   0,16         0   30676 /dev/shm/ora_orcl11g_688128_30
oracle  4884 oracle  mem    REG   0,16         0   30677 /dev/shm/ora_orcl11g_688128_31
oracle  4884 oracle  mem    REG   0,16         0   30678 /dev/shm/ora_orcl11g_688128_32
oracle  4884 oracle  mem    REG   0,16         0   30679 /dev/shm/ora_orcl11g_688128_33
oracle  4884 oracle  mem    REG   0,16         0   30680 /dev/shm/ora_orcl11g_688128_34
oracle  4884 oracle  mem    REG   0,16         0   30681 /dev/shm/ora_orcl11g_688128_35
oracle  4884 oracle  mem    REG   0,16         0   30682 /dev/shm/ora_orcl11g_688128_36
oracle  4884 oracle  mem    REG   0,16         0   30683 /dev/shm/ora_orcl11g_688128_37
oracle  4884 oracle  mem    REG   0,16         0   30684 /dev/shm/ora_orcl11g_688128_38
oracle  4884 oracle  mem    REG   0,16         0   30685 /dev/shm/ora_orcl11g_688128_39
oracle  4884 oracle  mem    REG   0,16   4194304   30686 /dev/shm/ora_orcl11g_688128_40
oracle  4884 oracle  mem    REG   0,16   4194304   30687 /dev/shm/ora_orcl11g_688128_41
oracle  4884 oracle  mem    REG   0,16   4194304   30688 /dev/shm/ora_orcl11g_688128_42
oracle  4884 oracle  mem    REG   0,16   4194304   30689 /dev/shm/ora_orcl11g_688128_43
oracle  4884 oracle  mem    REG   0,16   4194304   30690 /dev/shm/ora_orcl11g_688128_44
oracle  4884 oracle  mem    REG   0,16   4194304   30691 /dev/shm/ora_orcl11g_688128_45
oracle  4884 oracle  mem    REG   0,16   4194304   30692 /dev/shm/ora_orcl11g_688128_46
oracle  4884 oracle  mem    REG   0,16   4194304   30693 /dev/shm/ora_orcl11g_688128_47
oracle  4884 oracle  mem    REG   0,16   4194304   30694 /dev/shm/ora_orcl11g_688128_48
oracle  4884 oracle  mem    REG   0,16   4194304   30695 /dev/shm/ora_orcl11g_688128_49
oracle  4884 oracle  mem    REG   0,16   4194304   30696 /dev/shm/ora_orcl11g_688128_50
oracle  4884 oracle  mem    REG   0,16   4194304   30697 /dev/shm/ora_orcl11g_688128_51
oracle  4884 oracle  mem    REG   0,16   4194304   30698 /dev/shm/ora_orcl11g_688128_52
oracle  4884 oracle  mem    REG   0,16   4194304   30699 /dev/shm/ora_orcl11g_688128_53
oracle  4884 oracle  mem    REG   0,16   4194304   30700 /dev/shm/ora_orcl11g_688128_54
oracle  4884 oracle  mem    REG   0,16   4194304   30701 /dev/shm/ora_orcl11g_688128_55
oracle  4884 oracle  mem    REG   0,16   4194304   30702 /dev/shm/ora_orcl11g_688128_56
oracle  4884 oracle  mem    REG   0,16   4194304   30703 /dev/shm/ora_orcl11g_688128_57
oracle  4884 oracle  mem    REG   0,16   4194304   30704 /dev/shm/ora_orcl11g_688128_58
oracle  4884 oracle  mem    REG   0,16   4194304   30705 /dev/shm/ora_orcl11g_688128_59
oracle  4884 oracle  mem    REG   0,16   4194304   30706 /dev/shm/ora_orcl11g_688128_60
oracle  4884 oracle  mem    REG   0,16   4194304   30707 /dev/shm/ora_orcl11g_688128_61
oracle  4884 oracle  mem    REG   0,16   4194304   30708 /dev/shm/ora_orcl11g_688128_62
oracle  4884 oracle  mem    REG   0,16   4194304   30709 /dev/shm/ora_orcl11g_688128_63
oracle  4884 oracle  mem    REG   0,16   4194304   30710 /dev/shm/ora_orcl11g_688128_64
oracle  4884 oracle  mem    REG   0,16   4194304   30711 /dev/shm/ora_orcl11g_688128_65
oracle  4884 oracle  mem    REG   0,16   4194304   30712 /dev/shm/ora_orcl11g_688128_66
oracle  4884 oracle  mem    REG   0,16   4194304   30713 /dev/shm/ora_orcl11g_688128_67
oracle  4884 oracle  mem    REG   0,16   4194304   30714 /dev/shm/ora_orcl11g_688128_68
oracle  4884 oracle  mem    REG   0,16   4194304   30715 /dev/shm/ora_orcl11g_688128_69
oracle  4884 oracle  mem    REG   0,16   4194304   30716 /dev/shm/ora_orcl11g_688128_70
oracle  4884 oracle  mem    REG   0,16   4194304   30717 /dev/shm/ora_orcl11g_688128_71
oracle  4884 oracle  mem    REG   0,16   4194304   30718 /dev/shm/ora_orcl11g_688128_72
oracle  4884 oracle  mem    REG   0,16   4194304   30719 /dev/shm/ora_orcl11g_688128_73
oracle  4884 oracle  mem    REG   0,16   4194304   30720 /dev/shm/ora_orcl11g_688128_74
oracle  4884 oracle  mem    REG   0,16   4194304   30721 /dev/shm/ora_orcl11g_688128_75
oracle  4884 oracle  mem    REG   0,16   4194304   30722 /dev/shm/ora_orcl11g_688128_76
oracle  4884 oracle  mem    REG   0,16   4194304   30723 /dev/shm/ora_orcl11g_688128_77
oracle  4884 oracle  mem    REG   0,16   4194304   30724 /dev/shm/ora_orcl11g_688128_78
oracle  4884 oracle  mem    REG   0,16   4194304   30725 /dev/shm/ora_orcl11g_688128_79
oracle  4884 oracle  mem    REG   0,16   4194304   30726 /dev/shm/ora_orcl11g_688128_80
oracle  4884 oracle  mem    REG   0,16   4194304   30727 /dev/shm/ora_orcl11g_688128_81
oracle  4884 oracle  mem    REG   0,16   4194304   30728 /dev/shm/ora_orcl11g_688128_82
oracle  4884 oracle  mem    REG   0,16   4194304   30729 /dev/shm/ora_orcl11g_688128_83
oracle  4884 oracle  mem    REG   0,16   4194304   30730 /dev/shm/ora_orcl11g_688128_84
oracle  4884 oracle  mem    REG   0,16   4194304   30731 /dev/shm/ora_orcl11g_688128_85
oracle  4884 oracle  mem    REG   0,16   4194304   30732 /dev/shm/ora_orcl11g_688128_86
oracle  4884 oracle  mem    REG   0,16   4194304   30733 /dev/shm/ora_orcl11g_688128_87
oracle  4884 oracle  mem    REG   0,16   4194304   30734 /dev/shm/ora_orcl11g_688128_88
oracle  4884 oracle  mem    REG   0,16   4194304   30735 /dev/shm/ora_orcl11g_688128_89
oracle  4884 oracle  mem    REG   0,16   4194304   30736 /dev/shm/ora_orcl11g_688128_90
oracle  4884 oracle  mem    REG   0,16   4194304   30737 /dev/shm/ora_orcl11g_688128_91
oracle  4884 oracle  mem    REG   0,16   4194304   30738 /dev/shm/ora_orcl11g_688128_92
oracle  4884 oracle  mem    REG   0,16   4194304   30739 /dev/shm/ora_orcl11g_688128_93
oracle  4884 oracle  mem    REG   0,16   4194304   30740 /dev/shm/ora_orcl11g_688128_94
oracle  4884 oracle  mem    REG   0,16   4194304   30741 /dev/shm/ora_orcl11g_688128_95
oracle  4884 oracle  mem    REG   0,16   4194304   30742 /dev/shm/ora_orcl11g_688128_96
oracle  4884 oracle  mem    REG   0,16   4194304   30743 /dev/shm/ora_orcl11g_688128_97
oracle  4884 oracle  mem    REG   0,16   4194304   30744 /dev/shm/ora_orcl11g_688128_98
oracle  4884 oracle  mem    REG   0,16   4194304   30745 /dev/shm/ora_orcl11g_688128_99
oracle  4884 oracle  mem    REG   0,16   4194304   30746 /dev/shm/ora_orcl11g_688128_100
oracle  4884 oracle  mem    REG  253,0    156872  917907 /lib64/ld-2.12.so
oracle  4884 oracle  mem    REG  253,0      5624  917738 /lib64/libaio.so.1.0.1
oracle  4884 oracle  mem    REG  253,0   1918016  917908 /lib64/libc-2.12.so
oracle  4884 oracle  mem    REG  253,0    145720  917913 /lib64/libpthread-2.12.so
oracle  4884 oracle  mem    REG  253,0    598800  917909 /lib64/libm-2.12.so
oracle  4884 oracle  mem    REG  253,0     47064  917920 /lib64/librt-2.12.so
oracle  4884 oracle  mem    REG  253,0    116368  917655 /lib64/libnsl-2.12.so
oracle  4884 oracle  mem    CHR    1,5              3645 /dev/zero
oracle  4884 oracle  mem    REG  253,0     65928  917534 /lib64/libnss_files-2.12.so
oracle  4884 oracle  mem    REG  253,0     22536  917915 /lib64/libdl-2.12.so
oracle  4884 oracle  mem    REG  253,0    703495 1326729 /opt/oracle/products/11.2.0/lib/libasmclnt11.so
oracle  4884 oracle  mem    REG  253,0    150756 1326374 /opt/oracle/products/11.2.0/lib/libocrutl11.so
oracle  4884 oracle  mem    REG  253,0   3217927 1326373 /opt/oracle/products/11.2.0/lib/libocrb11.so
oracle  4884 oracle  mem    REG  253,0   1493029 1326372 /opt/oracle/products/11.2.0/lib/libocr11.so
oracle  4884 oracle  mem    REG  253,0     12771 1314370 /opt/oracle/products/11.2.0/lib/libskgxn2.so
oracle  4884 oracle  mem    REG  253,0  12820762 1326340 /opt/oracle/products/11.2.0/lib/libhasgen11.so
oracle  4884 oracle  mem    REG  253,0    162324 1314137 /opt/oracle/products/11.2.0/lib/libdbcfg11.so
oracle  4884 oracle  mem    REG  253,0    190634 1326342 /opt/oracle/products/11.2.0/lib/libclsra11.so
oracle  4884 oracle  mem    REG  253,0   7899997 1326546 /opt/oracle/products/11.2.0/lib/libnnz11.so
oracle  4884 oracle  mem    REG  253,0      1544 1327995 /opt/oracle/products/11.2.0/dbs/hc_orcl11g.dat
oracle  4884 oracle  mem    REG  253,0    851253 1313055 /opt/oracle/products/11.2.0/lib/libskgxp11.so
oracle  4884 oracle  mem    REG  253,0    460569 1326728 /opt/oracle/products/11.2.0/lib/libcell11.so
oracle  4884 oracle  mem    REG  253,0     12331 1311958 /opt/oracle/products/11.2.0/lib/libodmd11.so
oracle  4884 oracle    0r   CHR    1,3       0t0    3643 /dev/null
oracle  4884 oracle    1w   CHR    1,3       0t0    3643 /dev/null
oracle  4884 oracle    2w   CHR    1,3       0t0    3643 /dev/null
oracle  4884 oracle    3w   REG  253,0       765 1716105 /opt/oracle/products/11.2.0/rdbms/log/orcl11g_ora_4820.trc
oracle  4884 oracle    4r   CHR    1,3       0t0    3643 /dev/null
oracle  4884 oracle    5r   CHR    1,3       0t0    3643 /dev/null
oracle  4884 oracle    6r   CHR    1,3       0t0    3643 /dev/null
oracle  4884 oracle    7u   REG  253,0      1544 1327995 /opt/oracle/products/11.2.0/dbs/hc_orcl11g.dat
oracle  4884 oracle    8u   REG  253,0         0 1327994 /opt/oracle/products/11.2.0/dbs/lkinstorcl11g (deleted)
oracle  4884 oracle    9r   DIR    0,3         0   30896 /proc/4884/fd
oracle  4884 oracle   10w   REG  253,0     14367 1977638 /opt/oracle/diag/rdbms/orcl11g/orcl11g/trace/orcl11g_ora_4820.trc
oracle  4884 oracle   11w   REG  253,0       258 1977639 /opt/oracle/diag/rdbms/orcl11g/orcl11g/trace/orcl11g_ora_4820.trm
oracle  4884 oracle   12r   REG  253,0   1074176 1715159 /opt/oracle/products/11.2.0/rdbms/mesg/oraus.msb
oracle  4884 oracle   13r   CHR    1,5       0t0    3645 /dev/zero
oracle  4884 oracle   14r   DIR    0,3         0   30896 /proc/4884/fd
oracle  4884 oracle   15r   CHR    1,5       0t0    3645 /dev/zero
oracle  4884 oracle   16u   REG  253,0      1544 1327995 /opt/oracle/products/11.2.0/dbs/hc_orcl11g.dat
oracle  4884 oracle   17uR  REG  253,0        24 1327997 /opt/oracle/products/11.2.0/dbs/lkORCL11G
oracle  4884 oracle   18u   REG  253,0  15843328 1967839 /opt/oracle/oradata/orcl11g/control01.ctl
oracle  4884 oracle   19u   REG  253,0  15843328 1967840 /opt/oracle/flash_recovery_area/orcl11g/control02.ctl
oracle  4884 oracle   20uW  REG  253,0 734011392 1967874 /opt/oracle/oradata/orcl11g/system01.dbf
oracle  4884 oracle   21uW  REG  253,0 545267712 1967875 /opt/oracle/oradata/orcl11g/sysaux01.dbf
oracle  4884 oracle   22uW  REG  253,0  68165632 1967883 /opt/oracle/oradata/orcl11g/undotbs01.dbf
oracle  4884 oracle   23uW  REG  253,0  57679872 1967884 /opt/oracle/oradata/orcl11g/users01.dbf
oracle  4884 oracle   24uW  REG  253,0 838868992 1977635 /opt/oracle/oradata/orcl11g/zbdba.dbf
oracle  4884 oracle   25uW  REG  253,0 104865792 1977252 /opt/oracle/oradata/orcl11g/zbdba01.dbf (deleted)
oracle  4884 oracle   26uW  REG  253,0 125837312 1967879 /opt/oracle/oradata/orcl11g/test.dbf
oracle  4884 oracle   27uW  REG  253,0   1056768 1967890 /opt/oracle/oradata/orcl11g/test_size.dbf
oracle  4884 oracle   28uW  REG  253,0   2105344 1967891 /opt/oracle/oradata/orcl11g/test_size2.dbf
oracle  4884 oracle   29uW  REG  253,0 104865792 1968637 /opt/oracle/oradata/orcl11g/undotb02.dbf
oracle  4884 oracle   30uW  REG  253,0 104865792 1968177 /opt/oracle/oradata/orcl11g/temp.dbf
oracle  4884 oracle   31r   REG  253,0   1074176 1715159 /opt/oracle/products/11.2.0/rdbms/mesg/oraus.msb
[[email protected] ~]# ls -ltar /proc/4884/fd
total 0
dr-xr-xr-x 7 oracle oinstall  0 Nov  2 22:31 ..
dr-x------ 2 oracle oinstall  0 Nov  2 22:31 .
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 9 -> /proc/4884/fd
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 8 -> /opt/oracle/products/11.2.0/dbs/lkinstorcl11g (deleted)
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 7 -> /opt/oracle/products/11.2.0/dbs/hc_orcl11g.dat
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 6 -> /dev/null
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 5 -> /dev/null
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 31 -> /opt/oracle/products/11.2.0/rdbms/mesg/oraus.msb
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 30 -> /opt/oracle/oradata/orcl11g/temp.dbf
l-wx------ 1 oracle oinstall 64 Nov  2 22:33 3 -> /opt/oracle/products/11.2.0/rdbms/log/orcl11g_ora_4820.trc
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 29 -> /opt/oracle/oradata/orcl11g/undotb02.dbf
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 28 -> /opt/oracle/oradata/orcl11g/test_size2.dbf
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 27 -> /opt/oracle/oradata/orcl11g/test_size.dbf
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 26 -> /opt/oracle/oradata/orcl11g/test.dbf
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 25 -> /opt/oracle/oradata/orcl11g/zbdba01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 24 -> /opt/oracle/oradata/orcl11g/zbdba.dbf
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 23 -> /opt/oracle/oradata/orcl11g/users01.dbf
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 22 -> /opt/oracle/oradata/orcl11g/undotbs01.dbf
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 21 -> /opt/oracle/oradata/orcl11g/sysaux01.dbf
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 20 -> /opt/oracle/oradata/orcl11g/system01.dbf
l-wx------ 1 oracle oinstall 64 Nov  2 22:33 2 -> /dev/null
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 19 -> /opt/oracle/flash_recovery_area/orcl11g/control02.ctl
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 18 -> /opt/oracle/oradata/orcl11g/control01.ctl
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 17 -> /opt/oracle/products/11.2.0/dbs/lkORCL11G
lrwx------ 1 oracle oinstall 64 Nov  2 22:33 16 -> /opt/oracle/products/11.2.0/dbs/hc_orcl11g.dat
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 15 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 14 -> /proc/4884/fd
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 13 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 12 -> /opt/oracle/products/11.2.0/rdbms/mesg/oraus.msb
l-wx------ 1 oracle oinstall 64 Nov  2 22:33 11 -> /opt/oracle/diag/rdbms/orcl11g/orcl11g/trace/orcl11g_ora_4820.trm
l-wx------ 1 oracle oinstall 64 Nov  2 22:33 10 -> /opt/oracle/diag/rdbms/orcl11g/orcl11g/trace/orcl11g_ora_4820.trc
l-wx------ 1 oracle oinstall 64 Nov  2 22:33 1 -> /dev/null
lr-x------ 1 oracle oinstall 64 Nov  2 22:33 0 -> /dev/null

[[email protected] ~]# cd /proc/4884/fd

[[email protected] fd]# cat 25 > /opt/oracle/oradata/orcl11g/zbdba01.dbf
[[email protected] fd]# cd //opt/oracle/oradata/orcl11g/
[[email protected] orcl11g]# ls -lrt
total 2895908
-rw-r--r-- 1 oracle oinstall    405512 Oct 25 22:21 file.out
-rw-r----- 1 oracle oinstall  25174016 Oct 27 02:04 temp01.dbf
-rw-r----- 1 oracle oinstall  68165632 Oct 30 02:19 undo.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov  2 20:37 temp.dbf
-rw-r----- 1 oracle oinstall  52429312 Nov  2 22:31 redo01.log
-rw-r----- 1 oracle oinstall  52429312 Nov  2 22:31 redo02.log
-rw-r----- 1 oracle oinstall  68165632 Nov  2 22:31 undotbs01.dbf
-rw-r----- 1 oracle oinstall  57679872 Nov  2 22:31 users01.dbf
-rw-r----- 1 oracle oinstall 838868992 Nov  2 22:31 zbdba.dbf
-rw-r----- 1 oracle oinstall 125837312 Nov  2 22:31 test.dbf
-rw-r----- 1 oracle oinstall   1056768 Nov  2 22:31 test_size.dbf
-rw-r----- 1 oracle oinstall   2105344 Nov  2 22:31 test_size2.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov  2 22:31 1103.dbf
-rw-r----- 1 oracle oinstall 545267712 Nov  2 22:41 sysaux01.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov  2 22:42 undotb02.dbf
-rw-r----- 1 oracle oinstall 734011392 Nov  2 22:42 system01.dbf
-rw-r----- 1 oracle oinstall  52429312 Nov  2 22:47 redo03.log
-rw-r--r-- 1 root   root     104865792 Nov  2 22:47 zbdba01.dbf
-rw-r----- 1 oracle oinstall  15843328 Nov  2 22:48 control01.ctl
[[email protected] orcl11g]#
[[email protected] orcl11g]# chown -R oracle.oinstall zbdba01.dbf
[[email protected] orcl11g]# ls -lrt
total 2895908
-rw-r--r-- 1 oracle oinstall    405512 Oct 25 22:21 file.out
-rw-r----- 1 oracle oinstall  25174016 Oct 27 02:04 temp01.dbf
-rw-r----- 1 oracle oinstall  68165632 Oct 30 02:19 undo.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov  2 20:37 temp.dbf
-rw-r----- 1 oracle oinstall  52429312 Nov  2 22:31 redo01.log
-rw-r----- 1 oracle oinstall  52429312 Nov  2 22:31 redo02.log
-rw-r----- 1 oracle oinstall 104865792 Nov  2 22:31 1103.dbf
-rw-r--r-- 1 oracle oinstall 104865792 Nov  2 22:47 zbdba01.dbf
-rw-r----- 1 oracle oinstall  52429312 Nov  2 22:48 redo03.log
-rw-r----- 1 oracle oinstall 734011392 Nov  2 22:48 system01.dbf
-rw-r----- 1 oracle oinstall 545267712 Nov  2 22:48 sysaux01.dbf
-rw-r----- 1 oracle oinstall  68165632 Nov  2 22:48 undotbs01.dbf
-rw-r----- 1 oracle oinstall  57679872 Nov  2 22:48 users01.dbf
-rw-r----- 1 oracle oinstall 838868992 Nov  2 22:48 zbdba.dbf
-rw-r----- 1 oracle oinstall 125837312 Nov  2 22:48 test.dbf
-rw-r----- 1 oracle oinstall   1056768 Nov  2 22:48 test_size.dbf
-rw-r----- 1 oracle oinstall   2105344 Nov  2 22:48 test_size2.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov  2 22:48 undotb02.dbf
-rw-r----- 1 oracle oinstall  15843328 Nov  2 22:49 control01.ctl

[email protected]>startup
ORACLE instance started.
Total System Global Area  417546240 bytes
Fixed Size                  2213936 bytes
Variable Size             327157712 bytes
Database Buffers           83886080 bytes
Redo Buffers                4288512 bytes
Database mounted.
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/opt/oracle/oradata/orcl11g/zbdba01.dbf'
[email protected]>recover datafile 6;
Media recovery complete.
[email protected]>alter database open;

Database altered.

[email protected]>select file_name,status from dba_data_files;
FILE_NAME                                                    STATUS
------------------------------------------------------------ ------------------------------------------------------------
/opt/oracle/oradata/orcl11g/undotbs01.dbf                    AVAILABLE
/opt/oracle/oradata/orcl11g/zbdba.dbf                        AVAILABLE
/opt/oracle/oradata/orcl11g/zbdba01.dbf                      AVAILABLE
/opt/oracle/oradata/orcl11g/users01.dbf                      AVAILABLE
/opt/oracle/oradata/orcl11g/test.dbf                         AVAILABLE
/opt/oracle/oradata/orcl11g/sysaux01.dbf                     AVAILABLE
/opt/oracle/oradata/orcl11g/system01.dbf                     AVAILABLE
/opt/oracle/oradata/orcl11g/test_size.dbf                    AVAILABLE
/opt/oracle/oradata/orcl11g/test_size2.dbf                   AVAILABLE
/opt/oracle/oradata/orcl11g/undotb02.dbf                     AVAILABLE

再次查看该表:

[email protected]>conn zbdba/oracle;
Connected.
[email protected]>select * from zbdba;
NAME
------------------------------------------------------------
zbdba
huihui
时间: 2024-10-21 17:11:07

linux下误删数据文件恢复的相关文章

Linux下Oracle 数据文件被物理误删除的恢复

#加深对Linux句柄的理解/紧急情况下Oracle的快速恢复 不同于从Oracle中drop掉数据文件,在某些情况下,可能会遇到数据库在运行时数据文件在操作系统级别被删除,而此时Oracle实例并未崩溃,仍然处于open状态.此时就要求尽量在最小的影响下最高效率地完成恢复.现将恢复过程整理出来,以备不时之需. <<过程模拟>> <STEP 1>模拟删除 [email protected] >select name from v$datafile; NAME --

linux下rm -r误删NTFS文件恢复方法

linux下rm -r误删NTFS文件恢复方法(nfs-3g) 一时疏忽,手一抖,把整个挂载的F盘删了一半!顿时傻眼!! 被删的F盘是Windows下NTFS分区,在Ubuntu12.04中挂载了F盘,使用rm命令时粗心大意,误删了一半的数据. 血的教训告诉我们,使用rm -r命令一定要带上-i,否则让你后悔莫及! 还好在Linux下有一种方法可以恢复被删除的NTFS分区文件. 本文地址:http://www.cnblogs.com/yhLinux/p/4106099.html 在文件被误删后,

Linux下几种文件传输命令

Linux下几种文件传输命令 sz rz sftp scp 最近在部署系统时接触了一些文件传输命令,分别做一下简单记录: 1.sftp Secure Ftp 是一个基于SSH安全协议的文件传输管理工具.由于它是基于SSH的,会在传输过程中对用户的密码.数据等敏感信息进行加密,因此可以有效的防止用户信息在传输的过程中被窃取,比FTP有更高的安全性.在功能方面与FTP很类似,不仅可以传输文件数据,而且可以进行远程的文件管理(如建立,删除,查看文件列表等操作).Sftp与ftp虽然只有一字之差,但基于

[原创] Linux下几种文件传输命令 sz rz sftp scp介绍

Linux下几种文件传输命令 sz rz sftp scp介绍 1.sftp Secure Ftp 是一个基于SSH安全协议的文件传输管理工具.由于它是基于SSH的,会在传输过程中对用户的密码.数据等敏感信息进行加密,因此可以有效的防止用户信息在传输的过程中被窃取,比FTP有更高的安全性.在功能方面与FTP很类似,不仅可以传输文件数据,而且可以进行远程的文件管理(如建立,删除,查看文件列表等操作).Sftp与ftp虽然只有一字之差,但基于的传输协议却是不同的.因此不能用sftp client去连

linux下的数据备份工具rsync讲解

linux下的数据备份工具 rsync(remote sync 远程同步) 名词解释: sync(Synchronize,即"同步")为UNIX操作系统的标准系统调用,功能为将内核文件系统缓冲区的所有数据(也即预定将通过低级I/O系统调用写入存储介质的数据)写入存储介质(如硬盘). sync 是一个linux同步命令,含义为迫使缓冲块数据立即写盘并更新超级块.在linux系统中,为了加快数据的读取速度,默认情况下,某些数据将不会直接写 入硬盘,而是先暂存内存中,如果一个数据被重复写,这

linux下的 lib文件的学习思考

说到这个LIB文件,先从一个小故障说起. 某日开发说,一台测试用虚机可以PING通SSH不能连了.运维同学就赶紧去查,SSHD_CONFIG配置文件都正确啊,一点错误都没有,那为什么呢? 测试下,不管连自己还是其他机,都是报错 这里注意看,提示你有个libcom_err.so.2共享库文件找不到. 询问开发,才了解他们测试一个软件,意外删除了某个库文件. 那么在正常的相同虚机的机器查看下,再和出错的虚机比对下,发现少了2个库文件 挂载系统光盘或从正常的虚机上把这个两个文件拷贝过来,放到lib64

linux下删除整个文件夹或者文件命令实例

1.linux删除文件夹命令 在用Linux的时候,有时候要删除一个文件夹,往往会提示次此文件非空,没法删除,这个时候,就必须使用rm -rf命令. 2.linux删除文件夹实例: rm -rf /var/log/httpd/access 将会删除/var/log/httpd/access目录以及其下所有文件.文件夹 3.linux删除文件实例: rm -f /var/log/httpd/access.log 将会强制删除/var/log/httpd/access.log这个文件 -r 就是向下

Linux下校验下载文件的完整性(MD5,SHA1,PGP)

查看: Linux下校验下载文件的完整性(MD5,SHA1,PGP) http://blog.useasp.net/archive/2014/03/29/use-md5-sha1-or-pgp-to-check-downloaded-file-integrity-on-linux.aspx Linux下的学习开始总是艰难的,但有的时候,却发现Linux下远比Windows的操作来的实在的多——这下载文件的完整性就是其中一件,让本人觉着很爽的一件事情.在编译安装各种软件的时候,总要到各个网站上收集

linux下多进程的文件拷贝与进程相关的一些基础知识

之前实现了用文件IO的方式可以实现文件的拷贝,那么对于进程而言,我们是否也可以实现呢? 答案是肯定的. 进程资源: 首先我们先回顾一下,进程的运行需要哪些资源呢?其资源包括CPU资源,内存资源,当然还有时间片资源,我们都知道进程是有 栈, 堆,  只读数据段,  数据段(已初始化的全局变量静态变量),bss段(未初始化的),   代码段还有一组寄存器值. 进程命令: 另外我们也可以通过 ps  -ef |grep 进程名命令来查看进程号(PID)和父进程号(PPID),之后还可以通过 ps au