用lsof恢复误删除的数据库文件
删除测试数据库所有数据文件
cd /data/oracle/app/oracle/oradata
rm -rf test
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cd
[oracle@DEV-RPT-2 ~]$ cd /data/oracle/app/oracle/oradata
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ rm -rf test
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ ls -ld test
ls: test: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$
[oracle@DEV-RPT-2 ~]$ cd /data/oracle/app/oracle/oradata
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ rm -rf test
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ ls -ld test
ls: test: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$
用lsof查询oracle进程打开的文件
ps -ef|grep ora_lgwr_test
lsof -p 19335
[oracle@DEV-RPT-2 ~]$ ps -ef|grep ora_lgwr_test
oracle 19335 1 1 15:19 ? 00:00:00 ora_lgwr_test
oracle 19393 18391 0 15:20 pts/4 00:00:00 grep ora_lgwr_test
[oracle@DEV-RPT-2 ~]$ lsof -p 19335
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
oracle 19335 oracle cwd DIR 8,5 4096 343573 /data/oracle/app/oracle/product/10.2/dbs
oracle 19335 oracle rtd DIR 8,2 4096 2 /
oracle 19335 oracle txt REG 8,5 104920619 4971303 /data/oracle/app/oracle/product/10.2/bin/oracle
oracle 19335 oracle DEL REG 0,6 1409027 /SYSVc24a2604
oracle 19335 oracle mem REG 8,2 4176 1808011 /stub/lib64/libcwait.so
oracle 19335 oracle mem REG 8,5 177809 343723 /data/oracle/app/oracle/product/10.2/lib/libskgxp10.so
oracle 19335 oracle mem REG 8,5 1772385 343663 /data/oracle/app/oracle/product/10.2/lib/libhasgen10.so
oracle 19335 oracle mem REG 8,5 8545 343667 /data/oracle/app/oracle/product/10.2/lib/libskgxn2.so
oracle 19335 oracle mem REG 8,5 681761 343785 /data/oracle/app/oracle/product/10.2/lib/libocr10.so
oracle 19335 oracle mem REG 8,5 691049 343681 /data/oracle/app/oracle/product/10.2/lib/libocrb10.so
oracle 19335 oracle mem REG 8,5 516097 343671 /data/oracle/app/oracle/product/10.2/lib/libocrutl10.so
oracle 19335 oracle mem REG 8,5 11385162 343768 /data/oracle/app/oracle/product/10.2/lib/libjox10.so
oracle 19335 oracle mem REG 8,5 64041 343619 /data/oracle/app/oracle/product/10.2/lib/libclsra10.so
oracle 19335 oracle mem REG 8,5 123345 343740 /data/oracle/app/oracle/product/10.2/lib/libdbcfg10.so
oracle 19335 oracle mem REG 8,5 3796601 343782 /data/oracle/app/oracle/product/10.2/lib/libnnz10.so
oracle 19335 oracle mem REG 8,2 4000 619696 /usr/lib64/libaio.so.1.0.1
oracle 19335 oracle mem REG 8,2 15143 32596 /lib64/libdl-2.3.4.so
oracle 19335 oracle mem REG 8,2 610169 32626 /lib64/tls/libm-2.3.4.so
oracle 19335 oracle mem REG 8,2 103139 32628 /lib64/tls/libpthread-2.3.4.so
oracle 19335 oracle mem REG 8,2 104519 32600 /lib64/libnsl-2.3.4.so
oracle 19335 oracle mem REG 8,2 1488106 32624 /lib64/tls/libc-2.3.4.so
oracle 19335 oracle mem REG 8,2 19112 1018420 /usr/lib64/libnuma.so.1
oracle 19335 oracle mem REG 8,5 1544 343589 /data/oracle/app/oracle/product/10.2/dbs/hc_test.dat
oracle 19335 oracle mem CHR 1,5 2127 /dev/zero
oracle 19335 oracle mem REG 8,2 56902 32606 /lib64/libnss_files-2.3.4.so
oracle 19335 oracle mem REG 8,2 105080 32807 /lib64/ld-2.3.4.so
oracle 19335 oracle 0r CHR 1,3 2126 /dev/null
oracle 19335 oracle 1r CHR 1,3 2126 /dev/null
oracle 19335 oracle 2w REG 8,5 925 801283 /data/oracle/app/oracle/admin/test/bdump/test_lgwr_19335.trc
oracle 19335 oracle 3r CHR 1,3 2126 /dev/null
oracle 19335 oracle 4r CHR 1,3 2126 /dev/null
oracle 19335 oracle 5w REG 8,5 658 801276 /data/oracle/app/oracle/admin/test/udump/test_ora_19324.trc
oracle 19335 oracle 6w REG 8,5 643706 801272 /data/oracle/app/oracle/admin/test/bdump/alert_test.log
oracle 19335 oracle 7u REG 8,5 0 343693 /data/oracle/app/oracle/product/10.2/dbs/lkinsttest (deleted)
oracle 19335 oracle 8w REG 8,5 643706 801272 /data/oracle/app/oracle/admin/test/bdump/alert_test.log
oracle 19335 oracle 9u REG 8,5 1544 343589 /data/oracle/app/oracle/product/10.2/dbs/hc_test.dat
oracle 19335 oracle 10r CHR 1,5 2127 /dev/zero
oracle 19335 oracle 11r CHR 1,5 2127 /dev/zero
oracle 19335 oracle 12r REG 8,5 849408 4971267 /data/oracle/app/oracle/product/10.2/rdbms/mesg/oraus.msb
oracle 19335 oracle 13u REG 8,5 1544 343589 /data/oracle/app/oracle/product/10.2/dbs/hc_test.dat
oracle 19335 oracle 14uR REG 8,5 24 343583 /data/oracle/app/oracle/product/10.2/dbs/lkTEST
oracle 19335 oracle 15u REG 8,5 9093120 1210419 /data/oracle/app/oracle/oradata/test/control01.ctl (deleted)
oracle 19335 oracle 16u REG 8,5 9093120 1210050 /data/oracle/app/oracle/oradata/test/control02.ctl (deleted)
oracle 19335 oracle 17u REG 8,5 9093120 1210051 /data/oracle/app/oracle/oradata/test/control03.ctl (deleted)
oracle 19335 oracle 18u REG 8,5 104858112 1210052 /data/oracle/app/oracle/oradata/test/redo01.rdo (deleted)
oracle 19335 oracle 19u REG 8,5 104858112 1210053 /data/oracle/app/oracle/oradata/test/redo01b.rdo (deleted)
oracle 19335 oracle 20u REG 8,5 104858112 1210054 /data/oracle/app/oracle/oradata/test/redo02.rdo (deleted)
oracle 19335 oracle 21u REG 8,5 104858112 1210055 /data/oracle/app/oracle/oradata/test/redo02b.rdo (deleted)
oracle 19335 oracle 22u REG 8,5 104858112 1210056 /data/oracle/app/oracle/oradata/test/redo03.rdo (deleted)
oracle 19335 oracle 23u REG 8,5 104858112 1210057 /data/oracle/app/oracle/oradata/test/redo03b.rdo (deleted)
oracle 19335 oracle 24u REG 8,5 314580992 1210059 /data/oracle/app/oracle/oradata/test/system01.dbf (deleted)
oracle 19335 oracle 25u REG 8,5 209723392 1210063 /data/oracle/app/oracle/oradata/test/undotbs01.dbf (deleted)
oracle 19335 oracle 26u REG 8,5 146808832 1210058 /data/oracle/app/oracle/oradata/test/sysaux01.dbf (deleted)
oracle 19335 oracle 27u REG 8,5 5251072 1210064 /data/oracle/app/oracle/oradata/test/users01.dbf (deleted)
oracle 19335 oracle 28u REG 8,5 10493952 1210062 /data/oracle/app/oracle/oradata/test/ts_test01.dbf (deleted)
oracle 19335 oracle 29u REG 8,5 20979712 1210060 /data/oracle/app/oracle/oradata/test/temp01.dbf (deleted)
oracle 19335 oracle 30u REG 8,5 10493952 1210061 /data/oracle/app/oracle/oradata/test/ts_temp01.dbf (deleted)
oracle 19335 oracle 31r REG 8,5 849408 4971267 /data/oracle/app/oracle/product/10.2/rdbms/mesg/oraus.msb
[oracle@DEV-RPT-2 ~]$
控制文件(.ctl),数据文件(.dbf),重做日志文件(.rdo)显示为已被删除(deleted)oracle 19335 1 1 15:19 ? 00:00:00 ora_lgwr_test
oracle 19393 18391 0 15:20 pts/4 00:00:00 grep ora_lgwr_test
[oracle@DEV-RPT-2 ~]$ lsof -p 19335
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
oracle 19335 oracle cwd DIR 8,5 4096 343573 /data/oracle/app/oracle/product/10.2/dbs
oracle 19335 oracle rtd DIR 8,2 4096 2 /
oracle 19335 oracle txt REG 8,5 104920619 4971303 /data/oracle/app/oracle/product/10.2/bin/oracle
oracle 19335 oracle DEL REG 0,6 1409027 /SYSVc24a2604
oracle 19335 oracle mem REG 8,2 4176 1808011 /stub/lib64/libcwait.so
oracle 19335 oracle mem REG 8,5 177809 343723 /data/oracle/app/oracle/product/10.2/lib/libskgxp10.so
oracle 19335 oracle mem REG 8,5 1772385 343663 /data/oracle/app/oracle/product/10.2/lib/libhasgen10.so
oracle 19335 oracle mem REG 8,5 8545 343667 /data/oracle/app/oracle/product/10.2/lib/libskgxn2.so
oracle 19335 oracle mem REG 8,5 681761 343785 /data/oracle/app/oracle/product/10.2/lib/libocr10.so
oracle 19335 oracle mem REG 8,5 691049 343681 /data/oracle/app/oracle/product/10.2/lib/libocrb10.so
oracle 19335 oracle mem REG 8,5 516097 343671 /data/oracle/app/oracle/product/10.2/lib/libocrutl10.so
oracle 19335 oracle mem REG 8,5 11385162 343768 /data/oracle/app/oracle/product/10.2/lib/libjox10.so
oracle 19335 oracle mem REG 8,5 64041 343619 /data/oracle/app/oracle/product/10.2/lib/libclsra10.so
oracle 19335 oracle mem REG 8,5 123345 343740 /data/oracle/app/oracle/product/10.2/lib/libdbcfg10.so
oracle 19335 oracle mem REG 8,5 3796601 343782 /data/oracle/app/oracle/product/10.2/lib/libnnz10.so
oracle 19335 oracle mem REG 8,2 4000 619696 /usr/lib64/libaio.so.1.0.1
oracle 19335 oracle mem REG 8,2 15143 32596 /lib64/libdl-2.3.4.so
oracle 19335 oracle mem REG 8,2 610169 32626 /lib64/tls/libm-2.3.4.so
oracle 19335 oracle mem REG 8,2 103139 32628 /lib64/tls/libpthread-2.3.4.so
oracle 19335 oracle mem REG 8,2 104519 32600 /lib64/libnsl-2.3.4.so
oracle 19335 oracle mem REG 8,2 1488106 32624 /lib64/tls/libc-2.3.4.so
oracle 19335 oracle mem REG 8,2 19112 1018420 /usr/lib64/libnuma.so.1
oracle 19335 oracle mem REG 8,5 1544 343589 /data/oracle/app/oracle/product/10.2/dbs/hc_test.dat
oracle 19335 oracle mem CHR 1,5 2127 /dev/zero
oracle 19335 oracle mem REG 8,2 56902 32606 /lib64/libnss_files-2.3.4.so
oracle 19335 oracle mem REG 8,2 105080 32807 /lib64/ld-2.3.4.so
oracle 19335 oracle 0r CHR 1,3 2126 /dev/null
oracle 19335 oracle 1r CHR 1,3 2126 /dev/null
oracle 19335 oracle 2w REG 8,5 925 801283 /data/oracle/app/oracle/admin/test/bdump/test_lgwr_19335.trc
oracle 19335 oracle 3r CHR 1,3 2126 /dev/null
oracle 19335 oracle 4r CHR 1,3 2126 /dev/null
oracle 19335 oracle 5w REG 8,5 658 801276 /data/oracle/app/oracle/admin/test/udump/test_ora_19324.trc
oracle 19335 oracle 6w REG 8,5 643706 801272 /data/oracle/app/oracle/admin/test/bdump/alert_test.log
oracle 19335 oracle 7u REG 8,5 0 343693 /data/oracle/app/oracle/product/10.2/dbs/lkinsttest (deleted)
oracle 19335 oracle 8w REG 8,5 643706 801272 /data/oracle/app/oracle/admin/test/bdump/alert_test.log
oracle 19335 oracle 9u REG 8,5 1544 343589 /data/oracle/app/oracle/product/10.2/dbs/hc_test.dat
oracle 19335 oracle 10r CHR 1,5 2127 /dev/zero
oracle 19335 oracle 11r CHR 1,5 2127 /dev/zero
oracle 19335 oracle 12r REG 8,5 849408 4971267 /data/oracle/app/oracle/product/10.2/rdbms/mesg/oraus.msb
oracle 19335 oracle 13u REG 8,5 1544 343589 /data/oracle/app/oracle/product/10.2/dbs/hc_test.dat
oracle 19335 oracle 14uR REG 8,5 24 343583 /data/oracle/app/oracle/product/10.2/dbs/lkTEST
oracle 19335 oracle 15u REG 8,5 9093120 1210419 /data/oracle/app/oracle/oradata/test/control01.ctl (deleted)
oracle 19335 oracle 16u REG 8,5 9093120 1210050 /data/oracle/app/oracle/oradata/test/control02.ctl (deleted)
oracle 19335 oracle 17u REG 8,5 9093120 1210051 /data/oracle/app/oracle/oradata/test/control03.ctl (deleted)
oracle 19335 oracle 18u REG 8,5 104858112 1210052 /data/oracle/app/oracle/oradata/test/redo01.rdo (deleted)
oracle 19335 oracle 19u REG 8,5 104858112 1210053 /data/oracle/app/oracle/oradata/test/redo01b.rdo (deleted)
oracle 19335 oracle 20u REG 8,5 104858112 1210054 /data/oracle/app/oracle/oradata/test/redo02.rdo (deleted)
oracle 19335 oracle 21u REG 8,5 104858112 1210055 /data/oracle/app/oracle/oradata/test/redo02b.rdo (deleted)
oracle 19335 oracle 22u REG 8,5 104858112 1210056 /data/oracle/app/oracle/oradata/test/redo03.rdo (deleted)
oracle 19335 oracle 23u REG 8,5 104858112 1210057 /data/oracle/app/oracle/oradata/test/redo03b.rdo (deleted)
oracle 19335 oracle 24u REG 8,5 314580992 1210059 /data/oracle/app/oracle/oradata/test/system01.dbf (deleted)
oracle 19335 oracle 25u REG 8,5 209723392 1210063 /data/oracle/app/oracle/oradata/test/undotbs01.dbf (deleted)
oracle 19335 oracle 26u REG 8,5 146808832 1210058 /data/oracle/app/oracle/oradata/test/sysaux01.dbf (deleted)
oracle 19335 oracle 27u REG 8,5 5251072 1210064 /data/oracle/app/oracle/oradata/test/users01.dbf (deleted)
oracle 19335 oracle 28u REG 8,5 10493952 1210062 /data/oracle/app/oracle/oradata/test/ts_test01.dbf (deleted)
oracle 19335 oracle 29u REG 8,5 20979712 1210060 /data/oracle/app/oracle/oradata/test/temp01.dbf (deleted)
oracle 19335 oracle 30u REG 8,5 10493952 1210061 /data/oracle/app/oracle/oradata/test/ts_temp01.dbf (deleted)
oracle 19335 oracle 31r REG 8,5 849408 4971267 /data/oracle/app/oracle/product/10.2/rdbms/mesg/oraus.msb
[oracle@DEV-RPT-2 ~]$
打开文件顺序是控制文件, 重做日志文件, 系统表空间文件, 撤销表空间文件, 系统辅助表空间文件, 其它表空间文件, 临时表空间文件
用进程伪文件系统(/proc)恢复被删除的文件
mkdir -p /data/oracle/app/oracle/oradata/test.recv
cat /proc/19335/fd/15 >/data/oracle/app/oracle/oradata/test.recv/control01.ctl
cat /proc/19335/fd/16 >/data/oracle/app/oracle/oradata/test.recv/control02.ctl
cat /proc/19335/fd/17 >/data/oracle/app/oracle/oradata/test.recv/control03.ctl
cat /proc/19335/fd/18 >/data/oracle/app/oracle/oradata/test.recv/redo01.rdo
cat /proc/19335/fd/19 >/data/oracle/app/oracle/oradata/test.recv/redo01b.rdo
cat /proc/19335/fd/20 >/data/oracle/app/oracle/oradata/test.recv/redo02.rdo
cat /proc/19335/fd/21 >/data/oracle/app/oracle/oradata/test.recv/redo02b.rdo
cat /proc/19335/fd/22 >/data/oracle/app/oracle/oradata/test.recv/redo03.rdo
cat /proc/19335/fd/23 >/data/oracle/app/oracle/oradata/test.recv/redo03b.rdo
cat /proc/19335/fd/24 >/data/oracle/app/oracle/oradata/test.recv/system01.dbf
cat /proc/19335/fd/25 >/data/oracle/app/oracle/oradata/test.recv/undotbs01.dbf
cat /proc/19335/fd/26 >/data/oracle/app/oracle/oradata/test.recv/sysaux01.dbf
cat /proc/19335/fd/27 >/data/oracle/app/oracle/oradata/test.recv/users01.dbf
cat /proc/19335/fd/28 >/data/oracle/app/oracle/oradata/test.recv/ts_test01.dbf
cat /proc/19335/fd/29 >/data/oracle/app/oracle/oradata/test.recv/temp01.dbf
cat /proc/19335/fd/30 >/data/oracle/app/oracle/oradata/test.recv/ts_temp01.dbf
ls -l /data/oracle/app/oracle/oradata/test.recv/
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ mkdir -p /data/oracle/app/oracle/oradata/test.recv
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/15 >/data/oracle/app/oracle/oradata/test.recv/control01.ctl
cat /proc/17990/fd/16 >/data/oracle/app/oracle/oradata/test.recv/control02.ctl
cat /proc/17990/fd/17 >/data/oracle/app/oracle/oradata/test.recv/control03.ctl
cat /proc/17990/fd/18 >/data/oracle/app/oracle/oradata/test.recv/redo01.rdo
cat /proc/17990/fd/19 >/data/oracle/app/oracle/oradata/test.recv/redo01b.rdo
cat /proc/17990/fd/20 >/data/oracle/app/oracle/oradata/test.recv/redo02.rdo
cat /proc/17990/fd/21 >/data/oracle/app/oracle/oradata/test.recv/redo02b.rdo
cat /proc/17990/fd/22 >/data/oracle/app/oracle/oradata/test.recv/redo03.rdo
cat /proc/17990/fd/23 >/data/oracle/app/oracle/oradata/test.recv/redo03b.rdo
cat /proc/17990/fd/24 >/data/oracle/app/oracle/oradata/test.recv/system01.dbf
cat /proc/17990/fd/25 >/data/oracle/app/oracle/oradata/test.recv/undotbs01.dbf
cat /proc/17990/fd/26 >/data/oracle/app/oracle/oradata/test.recv/sysaux01.dbf
cat /proc/17990/fd/27 >/data/oracle/app/oracle/oradata/test.recv/users01.dbf
cat /proc/17990/fd/28 >/data/oracle/app/oracle/oradata/test.recv/ts_test01.dbf
cat /proc/17990/fd/29 >/data/oracle/app/oracle/oradata/test.recv/temp01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/16 >/data/oracle/app/oracle/oradata/test.recv/control02.ctl
cat /proc/17990/fd/30 >/data/oracle/app/oracle/oradata/test.recv/ts_temp01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/17 >/data/oracle/app/oracle/oradata/test.recv/control03.ctl
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/18 >/data/oracle/app/oracle/oradata/test.recv/redo01.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/19 >/data/oracle/app/oracle/oradata/test.recv/redo01b.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/20 >/data/oracle/app/oracle/oradata/test.recv/redo02.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/21 >/data/oracle/app/oracle/oradata/test.recv/redo02b.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/22 >/data/oracle/app/oracle/oradata/test.recv/redo03.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/23 >/data/oracle/app/oracle/oradata/test.recv/redo03b.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/24 >/data/oracle/app/oracle/oradata/test.recv/system01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/25 >/data/oracle/app/oracle/oradata/test.recv/undotbs01.dbf
cat: /proc/17990/fd/25: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/26 >/data/oracle/app/oracle/oradata/test.recv/sysaux01.dbf
cat: /proc/17990/fd/26: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/27 >/data/oracle/app/oracle/oradata/test.recv/users01.dbf
cat: /proc/17990/fd/27: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/28 >/data/oracle/app/oracle/oradata/test.recv/ts_test01.dbf
cat: /proc/17990/fd/28: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/29 >/data/oracle/app/oracle/oradata/test.recv/temp01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/30 >/data/oracle/app/oracle/oradata/test.recv/ts_temp01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ ls -l /data/oracle/app/oracle/oradata/test.recv/
total 1343952
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control01.ctl
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control02.ctl
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control03.ctl
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo01b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo01.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo02b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo02.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo03b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo03.rdo
-rw-r--r-- 1 oracle oinstall 146808832 Jan 25 15:23 sysaux01.dbf
-rw-r--r-- 1 oracle oinstall 314580992 Jan 25 15:23 system01.dbf
-rw-r--r-- 1 oracle oinstall 20979712 Jan 25 15:23 temp01.dbf
-rw-r--r-- 1 oracle oinstall 10493952 Jan 25 15:23 ts_temp01.dbf
-rw-r--r-- 1 oracle oinstall 10493952 Jan 25 15:23 ts_test01.dbf
-rw-r--r-- 1 oracle oinstall 209723392 Jan 25 15:23 undotbs01.dbf
-rw-r--r-- 1 oracle oinstall 5251072 Jan 25 15:23 users01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/15 >/data/oracle/app/oracle/oradata/test.recv/control01.ctl
cat /proc/17990/fd/16 >/data/oracle/app/oracle/oradata/test.recv/control02.ctl
cat /proc/17990/fd/17 >/data/oracle/app/oracle/oradata/test.recv/control03.ctl
cat /proc/17990/fd/18 >/data/oracle/app/oracle/oradata/test.recv/redo01.rdo
cat /proc/17990/fd/19 >/data/oracle/app/oracle/oradata/test.recv/redo01b.rdo
cat /proc/17990/fd/20 >/data/oracle/app/oracle/oradata/test.recv/redo02.rdo
cat /proc/17990/fd/21 >/data/oracle/app/oracle/oradata/test.recv/redo02b.rdo
cat /proc/17990/fd/22 >/data/oracle/app/oracle/oradata/test.recv/redo03.rdo
cat /proc/17990/fd/23 >/data/oracle/app/oracle/oradata/test.recv/redo03b.rdo
cat /proc/17990/fd/24 >/data/oracle/app/oracle/oradata/test.recv/system01.dbf
cat /proc/17990/fd/25 >/data/oracle/app/oracle/oradata/test.recv/undotbs01.dbf
cat /proc/17990/fd/26 >/data/oracle/app/oracle/oradata/test.recv/sysaux01.dbf
cat /proc/17990/fd/27 >/data/oracle/app/oracle/oradata/test.recv/users01.dbf
cat /proc/17990/fd/28 >/data/oracle/app/oracle/oradata/test.recv/ts_test01.dbf
cat /proc/17990/fd/29 >/data/oracle/app/oracle/oradata/test.recv/temp01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/16 >/data/oracle/app/oracle/oradata/test.recv/control02.ctl
cat /proc/17990/fd/30 >/data/oracle/app/oracle/oradata/test.recv/ts_temp01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/17 >/data/oracle/app/oracle/oradata/test.recv/control03.ctl
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/18 >/data/oracle/app/oracle/oradata/test.recv/redo01.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/19 >/data/oracle/app/oracle/oradata/test.recv/redo01b.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/20 >/data/oracle/app/oracle/oradata/test.recv/redo02.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/21 >/data/oracle/app/oracle/oradata/test.recv/redo02b.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/22 >/data/oracle/app/oracle/oradata/test.recv/redo03.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/23 >/data/oracle/app/oracle/oradata/test.recv/redo03b.rdo
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/24 >/data/oracle/app/oracle/oradata/test.recv/system01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/25 >/data/oracle/app/oracle/oradata/test.recv/undotbs01.dbf
cat: /proc/17990/fd/25: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/26 >/data/oracle/app/oracle/oradata/test.recv/sysaux01.dbf
cat: /proc/17990/fd/26: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/27 >/data/oracle/app/oracle/oradata/test.recv/users01.dbf
cat: /proc/17990/fd/27: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/28 >/data/oracle/app/oracle/oradata/test.recv/ts_test01.dbf
cat: /proc/17990/fd/28: No such file or directory
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/29 >/data/oracle/app/oracle/oradata/test.recv/temp01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cat /proc/17990/fd/30 >/data/oracle/app/oracle/oradata/test.recv/ts_temp01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ ls -l /data/oracle/app/oracle/oradata/test.recv/
total 1343952
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control01.ctl
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control02.ctl
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control03.ctl
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo01b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo01.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo02b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo02.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo03b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo03.rdo
-rw-r--r-- 1 oracle oinstall 146808832 Jan 25 15:23 sysaux01.dbf
-rw-r--r-- 1 oracle oinstall 314580992 Jan 25 15:23 system01.dbf
-rw-r--r-- 1 oracle oinstall 20979712 Jan 25 15:23 temp01.dbf
-rw-r--r-- 1 oracle oinstall 10493952 Jan 25 15:23 ts_temp01.dbf
-rw-r--r-- 1 oracle oinstall 10493952 Jan 25 15:23 ts_test01.dbf
-rw-r--r-- 1 oracle oinstall 209723392 Jan 25 15:23 undotbs01.dbf
-rw-r--r-- 1 oracle oinstall 5251072 Jan 25 15:23 users01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$
关闭数据库
conn / as sysdba
shutdown abort
SQL> conn / as sysdba
Connected.
SQL> shutdown abort
ORACLE instance shut down.
SQL>
Connected.
SQL> shutdown abort
ORACLE instance shut down.
SQL>
恢复文件到原来的目录
cd /data/oracle/app/oracle/oradata
rsync -av test.recv/ test/
ls -l test/
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ cd /data/oracle/app/oracle/oradata
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ rsync -av test.recv/ test/
building file list ... done
created directory test
./
control01.ctl
control02.ctl
control03.ctl
redo01.rdo
redo01b.rdo
redo02.rdo
redo02b.rdo
redo03.rdo
redo03b.rdo
sysaux01.dbf
system01.dbf
temp01.dbf
ts_temp01.dbf
ts_test01.dbf
undotbs01.dbf
users01.dbf
sent 1374928843 bytes received 340 bytes 211527566.62 bytes/sec
total size is 1374759936 speedup is 1.00
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ ls -l test/
total 1343952
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control01.ctl
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control02.ctl
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control03.ctl
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo01b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo01.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo02b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo02.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo03b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo03.rdo
-rw-r--r-- 1 oracle oinstall 146808832 Jan 25 15:23 sysaux01.dbf
-rw-r--r-- 1 oracle oinstall 314580992 Jan 25 15:23 system01.dbf
-rw-r--r-- 1 oracle oinstall 20979712 Jan 25 15:23 temp01.dbf
-rw-r--r-- 1 oracle oinstall 10493952 Jan 25 15:23 ts_temp01.dbf
-rw-r--r-- 1 oracle oinstall 10493952 Jan 25 15:23 ts_test01.dbf
-rw-r--r-- 1 oracle oinstall 209723392 Jan 25 15:23 undotbs01.dbf
-rw-r--r-- 1 oracle oinstall 5251072 Jan 25 15:23 users01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ rsync -av test.recv/ test/
building file list ... done
created directory test
./
control01.ctl
control02.ctl
control03.ctl
redo01.rdo
redo01b.rdo
redo02.rdo
redo02b.rdo
redo03.rdo
redo03b.rdo
sysaux01.dbf
system01.dbf
temp01.dbf
ts_temp01.dbf
ts_test01.dbf
undotbs01.dbf
users01.dbf
sent 1374928843 bytes received 340 bytes 211527566.62 bytes/sec
total size is 1374759936 speedup is 1.00
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$ ls -l test/
total 1343952
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control01.ctl
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control02.ctl
-rw-r--r-- 1 oracle oinstall 9093120 Jan 25 15:22 control03.ctl
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo01b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo01.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo02b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo02.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo03b.rdo
-rw-r--r-- 1 oracle oinstall 104858112 Jan 25 15:23 redo03.rdo
-rw-r--r-- 1 oracle oinstall 146808832 Jan 25 15:23 sysaux01.dbf
-rw-r--r-- 1 oracle oinstall 314580992 Jan 25 15:23 system01.dbf
-rw-r--r-- 1 oracle oinstall 20979712 Jan 25 15:23 temp01.dbf
-rw-r--r-- 1 oracle oinstall 10493952 Jan 25 15:23 ts_temp01.dbf
-rw-r--r-- 1 oracle oinstall 10493952 Jan 25 15:23 ts_test01.dbf
-rw-r--r-- 1 oracle oinstall 209723392 Jan 25 15:23 undotbs01.dbf
-rw-r--r-- 1 oracle oinstall 5251072 Jan 25 15:23 users01.dbf
[oracle@DEV-RPT-2 /data/oracle/app/oracle/oradata]$
启数据库
conn / as sysdba
startup
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated
ORA-01262: Stat failed on a file destination directory
Linux-x86_64 Error: 2: No such file or directory
SQL>
SQL> !mkdir /data/oracle/app/oracle/oradata/test/flash_recovery_area
SQL> !mkdir /data/oracle/app/oracle/oradata/test/archive
SQL> !mkdir /data/oracle/app/oracle/oradata/test/utlfile
SQL> startup
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 188744952 bytes
Database Buffers 117440512 bytes
Redo Buffers 6303744 bytes
Database mounted.
Database opened.
SQL>
Connected to an idle instance.
SQL> startup
ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated
ORA-01262: Stat failed on a file destination directory
Linux-x86_64 Error: 2: No such file or directory
SQL>
SQL> !mkdir /data/oracle/app/oracle/oradata/test/flash_recovery_area
SQL> !mkdir /data/oracle/app/oracle/oradata/test/archive
SQL> !mkdir /data/oracle/app/oracle/oradata/test/utlfile
SQL> startup
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 2083592 bytes
Variable Size 188744952 bytes
Database Buffers 117440512 bytes
Redo Buffers 6303744 bytes
Database mounted.
Database opened.
SQL>
一些问题:
1.
如果文件存放在netapp上, 被删除后文件名将变成.nfs0000000加一串数字, 比如
[oracle@DEV24-DB-1 /u01/dev24_db_1/DEV24-DB-1/oracle/app/oracle/oradata/s10]$ ls -la
total 14243836
drwxr-x--- 2 oracle oinstall 4096 Jan 24 22:55 .
drwxr-xr-x 4 oracle oinstall 4096 Jan 24 22:55 ..
-rw-r----- 1 oracle oinstall 10633216 Jan 25 00:55 .nfs0000000000022a2200000001
-rw-r----- 1 oracle oinstall 10633216 Jan 25 00:55 .nfs0000000000022a2300000002
-rw-r----- 1 oracle oinstall 10633216 Jan 25 00:55 .nfs0000000000022a2400000003
-rw-r----- 1 oracle oinstall 419438592 Jan 24 23:59 .nfs0000000000022a2500000004
-rw-r----- 1 oracle oinstall 52436992 Jan 24 23:59 .nfs0000000000022a2600000005
-rw-r----- 1 oracle oinstall 52436992 Jan 24 23:59 .nfs0000000000022a2700000006
-rw-r----- 1 oracle oinstall 199237632 Jan 25 00:44 .nfs0000000000022a2800000007
-rw-r----- 1 oracle oinstall 314580992 Jan 25 00:54 .nfs0000000000022a2900000008
-rw-r----- 1 oracle oinstall 109060096 Jan 24 06:00 .nfs0000000000022a2a00000009
-rw-r----- 1 oracle oinstall 5489303552 Jan 25 00:55 .nfs0000000000022a2b0000000a
-rw-r----- 1 oracle oinstall 5251072 Jan 24 23:59 .nfs0000000000022a2c0000000b
-rw-r----- 1 oracle oinstall 20979712 Jan 24 23:59 .nfs0000000000022a2d0000000c
-rw-r----- 1 oracle oinstall 20979712 Jan 24 23:59 .nfs0000000000022a2e0000000d
-rw-r----- 1 oracle oinstall 104858112 Jan 24 23:54 .nfs0000000000022a320000000e
-rw-r----- 1 oracle oinstall 104858112 Jan 25 00:55 .nfs0000000000022a330000000f
-rw-r----- 1 oracle oinstall 104858112 Jan 24 23:24 .nfs00000000000554d600000010
-rw-r----- 1 oracle oinstall 5358231552 Jan 25 00:54 .nfs00000000000554d800000011
-rw-r----- 1 oracle oinstall 1908416512 Jan 25 00:53 .nfs00000000000554d900000012
-rw-r----- 1 oracle oinstall 209723392 Jan 24 23:59 .nfs00000000000554dd00000013
-rw-r----- 1 oracle oinstall 52436992 Jan 24 23:59 .nfs00000000000554de00000014
可以按文件大小, 文件描述符序号, 查看数据字典,数据文件内容等, 得出文件名total 14243836
drwxr-x--- 2 oracle oinstall 4096 Jan 24 22:55 .
drwxr-xr-x 4 oracle oinstall 4096 Jan 24 22:55 ..
-rw-r----- 1 oracle oinstall 10633216 Jan 25 00:55 .nfs0000000000022a2200000001
-rw-r----- 1 oracle oinstall 10633216 Jan 25 00:55 .nfs0000000000022a2300000002
-rw-r----- 1 oracle oinstall 10633216 Jan 25 00:55 .nfs0000000000022a2400000003
-rw-r----- 1 oracle oinstall 419438592 Jan 24 23:59 .nfs0000000000022a2500000004
-rw-r----- 1 oracle oinstall 52436992 Jan 24 23:59 .nfs0000000000022a2600000005
-rw-r----- 1 oracle oinstall 52436992 Jan 24 23:59 .nfs0000000000022a2700000006
-rw-r----- 1 oracle oinstall 199237632 Jan 25 00:44 .nfs0000000000022a2800000007
-rw-r----- 1 oracle oinstall 314580992 Jan 25 00:54 .nfs0000000000022a2900000008
-rw-r----- 1 oracle oinstall 109060096 Jan 24 06:00 .nfs0000000000022a2a00000009
-rw-r----- 1 oracle oinstall 5489303552 Jan 25 00:55 .nfs0000000000022a2b0000000a
-rw-r----- 1 oracle oinstall 5251072 Jan 24 23:59 .nfs0000000000022a2c0000000b
-rw-r----- 1 oracle oinstall 20979712 Jan 24 23:59 .nfs0000000000022a2d0000000c
-rw-r----- 1 oracle oinstall 20979712 Jan 24 23:59 .nfs0000000000022a2e0000000d
-rw-r----- 1 oracle oinstall 104858112 Jan 24 23:54 .nfs0000000000022a320000000e
-rw-r----- 1 oracle oinstall 104858112 Jan 25 00:55 .nfs0000000000022a330000000f
-rw-r----- 1 oracle oinstall 104858112 Jan 24 23:24 .nfs00000000000554d600000010
-rw-r----- 1 oracle oinstall 5358231552 Jan 25 00:54 .nfs00000000000554d800000011
-rw-r----- 1 oracle oinstall 1908416512 Jan 25 00:53 .nfs00000000000554d900000012
-rw-r----- 1 oracle oinstall 209723392 Jan 24 23:59 .nfs00000000000554dd00000013
-rw-r----- 1 oracle oinstall 52436992 Jan 24 23:59 .nfs00000000000554de00000014
2.
打开数据库报错ora-1251, 说明文件名不对, 需要修正
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01122: database file 6 failed verification check
ORA-01110: data file 6: '/home/oracle/app/oracle/oradata/s10/xiewen_data01.dbf'
ORA-01251: Unknown File Header Version read for file number 6
SQL>
alter database open
*
ERROR at line 1:
ORA-01122: database file 6 failed verification check
ORA-01110: data file 6: '/home/oracle/app/oracle/oradata/s10/xiewen_data01.dbf'
ORA-01251: Unknown File Header Version read for file number 6
SQL>
oerr ora 1251
01251, 00000, "Unknown File Header Version read for file number %s"
// *Cause: Read of the file header returned a record but its version cannot
// be identified. Either the header has been corrupted, or the file
// is not a valid database file.
// *Action: Have the operating system make the correct file available to
// the database, or recover the file.
01251, 00000, "Unknown File Header Version read for file number %s"
// *Cause: Read of the file header returned a record but its version cannot
// be identified. Either the header has been corrupted, or the file
// is not a valid database file.
// *Action: Have the operating system make the correct file available to
// the database, or recover the file.
3.
打开数据库报错 ora-600 kcratr1_lastbwr
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [],
[], [], []
SQL>
alter database open
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [],
[], [], []
SQL>
参考 ORA-00600:[Kcratr1_lastbwr] During Database Startup after a Crash
手工恢复即可
SQL> recover database;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL>
Media recovery complete.
SQL> alter database open;
Database altered.
SQL>
-fin-
教材5-35