使用Linux文件句柄恢复误删除的Oracle数据文件

WBOY
풀어 주다: 2016-06-07 17:31:59
원래의
966명이 탐색했습니다.

测试环境:OEL+Oracle 11.2.0.1 首先查看当前的数据文件及数据文件状态: SQLgt; select file_id,tablespace_name,file_name

SQL> select file#,status,name from v$datafile;

 

FILE# STATUS NAME

---------- ------- ----------------------------------------

1 SYSTEM /oradata/orcl2/system01.dbf

2 ONLINE /oradata/orcl2/sysaux01.dbf

3 ONLINE /oradata/orcl2/undotbs01.dbf

4 ONLINE /oradata/orcl2/users01.dbf

5 ONLINE /oradata/orcl2/SG01.dbf

6 ONLINE /oradata/orcl2/book.dbf

 

准备对数据文件/oradata/orcl2/SG01.dbf进行rm删除并使用Linux句柄进行恢复,,删除后切记不可将实例shutdown(其实shutdown后也没关系,只是会使恢复更麻烦);

删除数据文件/oradata/orcl2/SG01.dbf

[oracle@DBA2 orcl2]$ rm SG01.dbf

[oracle@DBA2 orcl2]$

查看文件句柄,发现/oradata/orcl2/SG01.dbf状态为(delete)如红显处:

[oracle@DBA2 orcl2]$ ps -ef|grep dbw|grep -v grep|awk '{print $2}'

3140

PS:3140 为DBWn进程的pid,DBWn进程引用此句柄对数据文件操作,其实也可以用LGWR等其他Oracle进程,不一定非得用DBWn这个进程的pid;

[oracle@DBA2 orcl2]$ cd /proc/3140/fd

[oracle@DBA2 fd]$ ls -al

total 0

dr-x------ 2 oracle oinstall 0 Sep 4 09:28 .

dr-xr-xr-x 7 oracle oinstall 0 Sep 4 09:28 ..

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 0 -> /dev/null

l-wx------ 1 oracle oinstall 64 Sep 4 09:41 1 -> /dev/null

l-wx------ 1 oracle oinstall 64 Sep 4 09:41 10 -> /u/oracle/diag/rdbms/orcl2/orcl2/trace/orcl2_ora_3056.trc

l-wx------ 1 oracle oinstall 64 Sep 4 09:41 11 -> /u/oracle/diag/rdbms/orcl2/orcl2/trace/orcl2_ora_3056.trm

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 12 -> /u/oracle/product/11.2/rdbms/mesg/oraus.msb

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 13 -> /dev/zero

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 14 -> /proc/3140/fd

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 15 -> /dev/zero

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 16 -> /u/oracle/product/11.2/dbs/hc_orcl2.dat

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 17 -> /u/oracle/product/11.2/dbs/lkORCL2

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 18 -> /oradata/orcl2/control01.ctl

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 19 -> /u/oracle/flash_recovery_area/orcl2/control02.ctl

l-wx------ 1 oracle oinstall 64 Sep 4 09:41 2 -> /dev/null

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 20 -> /oradata/orcl2/system01.dbf

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 21 -> /oradata/orcl2/sysaux01.dbf

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 22 -> /oradata/orcl2/undotbs01.dbf

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 23 -> /oradata/orcl2/users01.dbf

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 24 -> /oradata/orcl2/SG01.dbf (deleted)

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 25 -> /oradata/orcl2/book.dbf

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 26 -> /oradata/orcl2/temp01.dbf

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 27 -> /oradata/orcl2/temp02.dbf

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 28 -> /oradata/orcl2/temo01.dbf

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 29 -> /u/oracle/product/11.2/rdbms/mesg/oraus.msb

l-wx------ 1 oracle oinstall 64 Sep 4 09:41 3 -> /u/oracle/product/11.2/rdbms/log/orcl2_ora_3056.trc

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 4 -> /dev/null

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 5 -> /dev/null

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 6 -> /dev/null

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 7 -> /u/oracle/product/11.2/dbs/hc_orcl2.dat

lrwx------ 1 oracle oinstall 64 Sep 4 09:41 8 -> /u/oracle/product/11.2/dbs/lkinstorcl2 (deleted)

lr-x------ 1 oracle oinstall 64 Sep 4 09:41 9 -> /proc/3140/fd

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!