How to recover files that were accidentally deleted under Linux

Source: Internet
Author: User
Tags dba linux

Today, a customer's database accidentally deleted the entire directory of data files, operating system level deletion, but fortunately the database did not crash, still in the open state, the customer found a problem, help us, and finally fully recover all the data files.

Under Linux, a general demonstration of the recovery process, the recovery steps and the database version is not much of a relationship, and the operating system will vary.

1. Delete data files in the users table space directly when the database is open.

Sql> select name from V$datafile;

NAME

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

/app/oracle/oradata/orcl/datafile/o1_mf_system_555wqbnk_.dbf

/app/oracle/oradata/orcl/datafile/o1_mf_undotbs1_555wqxgl_.dbf

/app/oracle/oradata/orcl/datafile/o1_mf_sysaux_555wr5p6_.dbf

/app/oracle/oradata/orcl/datafile/o1_mf_users_555wrj4o_.dbf

Sql> Host RM/APP/ORACLE/ORADATA/ORCL/DATAFILE/O1_MF_USERS_555WRJ4O_.DBF

2. Try to create a table in the Users table space and start an error.

Sql> CREATE TABLE T tablespace users as SELECT * from dual;

CREATE TABLE T tablespace users as SELECT * from dual

*

ERROR at line 1:

Ora-01116:error in opening database file 4

Ora-01110:data File 4:

'/APP/ORACLE/ORADATA/ORCL/DATAFILE/O1_MF_USERS_555WRJ4O_.DBF '

Ora-27041:unable to open File

Linux error:2: No such file or directory

Additional Information:3

Similar information can also be seen in the alarm log.

Mon Dec 21:48:17 CST 2011

Errors in FILE/APP/ORACLE/ADMIN/ORCL/BDUMP/ORCL_M000_3897.TRC:

Ora-01116:error in opening database file 4

Ora-01110:data file 4: '/APP/ORACLE/ORADATA/ORCL/DATAFILE/O1_MF_USERS_555WRJ4O_.DBF '

Ora-27041:unable to open File

Linux error:2: No such file or directory

Additional Information:3

3. Check the DBWR process PID

$ ps-ef|grep dbw0|grep-v grep

Oracle 2879 1 0 21:38? 00:00:00 ORA_DBW0_ORCL

This paper url:http://www.bianceng.cn/os/linux/201410/45614.htm

4. DBWR will open the handle to all data files. As can be found in the proc directory, the directory name is a process PID,FD representation of the file descriptor.

$ cd/proc/2879/fd

$ ls-l

Total 0

LR-X------1 Oracle DBA 21:50 0->/dev/null

LR-X------1 Oracle DBA 21:50 1->/dev/null

LR-X------1 Oracle DBA 21:50->/dev/zero

LR-X------1 Oracle DBA 21:50->/dev/zero

LR-X------1 Oracle DBA 21:50->/APP/ORACLE/PRODUCT/10.2.0/DB_1/RDBMS/MESG/ORAUS.MSB

LRWX------1 Oracle DBA 21:50->/app/oracle/product/10.2.0/db_1/dbs/hc_orcl.dat

LRWX------1 Oracle DBA 21:50->/APP/ORACLE/PRODUCT/10.2.0/DB_1/DBS/LKORCL

LRWX------1 Oracle DBA 21:50->/APP/ORACLE/ORADATA/ORCL/CONTROLFILE/O1_MF_555WQ3NG_.CTL

LRWX------1 Oracle DBA 21:50->/APP/ORACLE/ORADATA/ORCL/DATAFILE/O1_MF_SYSTEM_555WQBNK_.DBF

LRWX------1 Oracle DBA 21:50->/APP/ORACLE/ORADATA/ORCL/DATAFILE/O1_MF_UNDOTBS1_555WQXGL_.DBF

LRWX------1 Oracle DBA 21:50->/APP/ORACLE/ORADATA/ORCL/DATAFILE/O1_MF_SYSAUX_555WR5P6_.DBF

LRWX------1 Oracle DBA 21:50->/app/oracle/oradata/orcl/datafile/o1_mf_users_555wrj4o_.dbf (Deleted)

LR-X------1 Oracle DBA 21:50 2->/dev/null

LRWX------1 Oracle DBA 21:50->/app/oracle/oradata/orcl/datafile/o1_mf_temp_555wrbnz_.tmp

LR-X------1 Oracle DBA 21:50->/APP/ORACLE/PRODUCT/10.2.0/DB_1/RDBMS/MESG/ORAUS.MSB

LR-X------1 Oracle DBA 21:50 3->/dev/null

LR-X------1 Oracle DBA 21:50 4->/dev/null

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.