Linux mistakenly deletes Oracle data file Recovery __ios

Source: Internet
Author: User
This article I have, the right to record inquiries, the original to the current torch Oracle Lunar goddess
[Oracle@lunar ~]$ sqlplus/as sysdba sql*plus:release 11.2.0.3.0 Production on Fri Mar 23:46:35 2013 Copyrigh   T (c) 1982, Oracle.     All rights reserved. Connected to:oracle Database 11g Enterprise Edition release 11.2.0.3.0-64bit Production with the partitioning, Ola   P, Data Mining and real application testing options sql> select Tablespace_name from Dba_tablespaces; Tablespace_name------------------------------------------------------------SYSTEM sysaux UNDOTBS1 TEM P USERS EZIO 6 rows selected.


To create a test table space

sql> Create tablespace lunar_test datafile '/test/lunar_test01.dbf ' size 10M;   Tablespace created.   sql> alter user lunar default tablespace lunar_test; User altered.


CREATE TABLE Insert Data

Sql> Conn Lunar/lunar Connected.   Sql> CREATE TABLE test_table (name VARCHAR2 ()) tablespace lunar_test;   Table created.   sql> INSERT into test_table values (' Love your Forever, my baby, Happy childrens day! ');   1 row created.   Sql> commit;   Commit complete.   Sql> sql> SELECT * from test_table; NAME--------------------------------------------------------------------------------Love your Forever, my baby, Happy Childrens Day!


Delete DataFile

sql>!rm-rf/test/lunar_test01.dbf sql>!ls-lrt/test/lunar_test01.dbf ls:/test/lunar_test01.dbf:no such fil E or directory sql>


The data is still there, because it's read from the buffer cache

Sql> Conn Lunar/lunar Connected.   Sql> select * from test_table; NAME--------------------------------------------------------------------------------Love your Forever, my baby, Happy Childrens Day!


Execute Flush Buffer Cache

Sql> conn/as sysdba Connected.   Sql> alter system flush Buffer_cache; System altered.


Can see, query again, error file status is wrong (can't find it)

Sql> Conn Lunar/lunar Connected. Sql> select * from test_table;  SELECT * FROM Test_table * ERROR at line 1:ora-01116:error in opening database file 6 Ora-01110:data file 6: '/TEST/LUNAR_TEST01.DBF ' ora-27041:unable to open file linux-x86_64 error:2: No such file or directory Additional Information:3


Check the SPID of the DBWR process

sql>!ps-ef|grep dBW Oracle 2757 1 0 12:29? 00:00:14 ora_dbw0_bb Oracle 8912 8872 0 23:50 pts/3 00:00:00/bin/bash-c ps-ef|grep dbw Oracle 8914 8912 0 23:50 PTS/3 00:00:00 grep DBW


Find the handle to DBWR

sql>!/usr/sbin/lsof-p 2757 command  pid    user    FD   TYPE DEVICE& nbsp;   size/off     node  NAME oracle  2757 oracle  cwd     dir  253,0       4096 6947181/u01/app/oracle/product/11.2.0.3/dbhome_1/ DBS oracle  2757 oracle  rtd    dir  253,0       4096        2/oracle  2757 oracle  txt    reg  253,0  232399473 1179781/u01/app/oracle/product/11.2.0.3/dbhome_1/bin/oracle oracle  2757 oracle  DEL     reg    0,4            1933317/ SYSV00000000 oracle  2757 oracle  del    reg            1966086/sysv00000000 oracle  2757oracle  del    reg    0,4             1998855/sysv2b7268c4 oracle  2757 oracle  mem    reg  253,0      144776 2293762/lib64/ld-2.5.so oracle  2757 oracle  mem    REG  253,0        5328 4822547/usr/lib64/libaio.so.1.0.1 oracle  2757 oracle  mem     reg  253,0    1722328 2293764/lib64/libc-2.5.so oracle  2757 oracle  mem& nbsp;   reg  253,0      23360 2293771/lib64/libdl-2.5.so oracle  2757 oracle  mem    reg  253,0     615136 2293809/lib64/libm-2.5.so Oracle   2757 oracle  mem    reg  253,0     145872 2293775/lib64/ libpthread-2.5.so oracle  2757 oracle  mem    reg  253,0      53448 2293781/lib64/librt-2.5.so oracle  2757 oracle    reg  253,0     114352 2293986/lib64/libnsl-2.5.so oracle  2757 oracle  mem& nbsp;   reg  253,0      58949 6955646/u01/app/oracle/product/11.2.0.3/ dbhome_1/lib/libnque11.so oracle  2757 oracle  262uw  reg  253,0   87040000 4784725/u01/ APP/ORACLE/ORADATA/BB/TEMP01.DBF oracle  2757 oracle  263uw  reg  253,0   10493952 1639050/TEST/LUNAR_TEST01.DBF (deleted)    can see that the file is identified as delete


Enter the file descriptor number directory of the DBWR process

sql>!ls-ltar/proc/2757/fd/total 0 dr-xr-xr-x 7 Oracle oinstall  0 Mar 15 12:29. DR-X------2 Oracle oinstall  0 Mar 15 12:29. LR-X------1 Oracle Oinstall 1 23:30 9->/dev/null lr-x------Oracle Oinstall Mar 23:30 8->/dev /null lrwx------1 Oracle Oinstall 23:30 7->/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/hc_bb.dat lr-x- -----1 Oracle Oinstall 23:30 6->/dev/null lr-x------1 Oracle Oinstall Mar 23:30 5->/dev/null LR-X------1 Oracle Oinstall 1 23:30 4->/dev/null lr-x------Oracle Oinstall Mar 23:30 3->/dev /null lrwx------1 Oracle oinstall Mar 23:30 263->/test/lunar_test01.dbf (deleted)    the FD number of the process that can see DBWR LRWX------1 Oracle oinstall 23:30 262->/u01/app/oracle/oradata/bb/temp01.dbf lrwx------1 Oracle Oinsta LL-23:30 261->/u01/app/oracle/oradata/bb/ezio01.dbf lrwx------1 Oracle Oinstall-Mar 23:30T /U01/APP/ORACLE/ORADATA/BB/USERS01.DBF lrwx------1 Oracle oinstall 23:30 259->/u01/app/oracle/oradata/bb/ UNDOTBS01.DBF lrwx------1 Oracle Oinstall (23:30) 258->/u01/app/oracle/oradata/bb/sysaux01.dbf lrwx------ 1 Oracle oinstall 23:30 257->/u01/app/oracle/oradata/bb/system01.dbf lrwx------1 Oracle Oinstall 1 Mar 5 23:30 256->/u01/app/oracle/oradata/bb/control01.ctl l-wx------1 Oracle Oinstall 23:30 2->/dev/null LR-X------1 Oracle oinstall 23:30->/U01/APP/ORACLE/PRODUCT/11.2.0.3/DBHOME_1/RDBMS/MESG/ORAUS.MSB LRW X------1 Oracle Oinstall 23:30->/U01/APP/ORACLE/PRODUCT/11.2.0.3/DBHOME_1/DBS/LKBB lrwx------1 Oracl E oinstall 23:30->/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/hc_bb.dat lr-x------1 Oracle Oinstall 23:30->/dev/zero lr-x------1 Oracle oinstall 23:30->/proc/2757/fd

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.