13.lsof恢复删除的文件
[root@temp ~]# lsof -p 5643
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
oracle 5643 oracle cwd DIR 8,2 4096 1556206 /u01/app/oracle/product/10.2.0/db_1/dbs
oracle 5643 oracle rtd DIR 8,2 4096 2 /
oracle 5643 oracle txt REG 8,2 93362427 1557452 /u01/app/oracle/product/10.2.0/db_1/bin/oracle
oracle 5643 oracle mem REG 8,2 70077 1565448 /u01/app/oracle/product/10.2.0/db_1/lib/libclsra10.so
oracle 5643 oracle mem REG 8,2 50848 389032 /lib/libnss_files-2.5.so
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
oracle 5643 oracle cwd DIR 8,2 4096 1556206 /u01/app/oracle/product/10.2.0/db_1/dbs
oracle 5643 oracle rtd DIR 8,2 4096 2 /
oracle 5643 oracle txt REG 8,2 93362427 1557452 /u01/app/oracle/product/10.2.0/db_1/bin/oracle
oracle 5643 oracle mem REG 8,2 70077 1565448 /u01/app/oracle/product/10.2.0/db_1/lib/libclsra10.so
oracle 5643 oracle mem REG 8,2 50848 389032 /lib/libnss_files-2.5.so
** 把 o1_mf_ggs_data_8rq64t53_.dbf 删除 **
[oracle@temp datafile]$ rm -rf o1_mf_ggs_data_8rq64t53_.dbf
** 列出23 号文件句柄的信息 ***
[root@temp ~]# ls -alh /proc/5643/fd/23
lrwx------ 1 oracle oinstall 64 06-19 18:08 /proc/5643/fd/23 -> /u01/app/oracle/oradata/ORCL/datafile/o1_mf_ggs_data_8rq64t53_.dbf (deleted)
** 直接复制过去就行了 **
[root@temp ~]# cp /proc/5643/fd/23 /u01/app/oracle/oradata/ORCL/datafile/
[root@temp ~]# chown -R oracle:oinstall /u01/app/oracle/oradata/ORCL/datafile/23
[oracle@temp datafile]$ mv 23 o1_mf_ggs_data_8rq64t53_.dbf
sys@ORCL> shutdown immediate
sys@ORCL> startup
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/u01/app/oracle/oradata/ORCL/datafile/o1_mf_ggs_data_8rq64t53_.dbf'
sys@ORCL> recover datafile 6;
sys@ORCL> alter database open;