Restoration of accidentally deleted data files in ORACLE in Linux

Source: Internet
Author: User

Check the location of the data file as follows:
 
SQL> select name from v $ datafile;
 
NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/marven/system01.dbf
/U01/app/oracle/oradata/marven/undotbs1.dbf
/U01/app/oracle/oradata/marven/sysaux01.dbf
/U01/app/oracle/oradata/marven/users01.dbf
/U01/app/oracle/oradata/marven/marven01.dbf
 
Delete data files on the Operating System
 
SQL>! Rm/u01/app/oracle/oradata/marven/*. dbf
 
An error occurred while creating the table.
 
SQL> create table test2 as select * from dba_tables;
Create table test2 as select * from dba_tables
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
The ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/marven/system01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
 
 
SQL>! Www.2cto.com
 
In this case, do not close the instance and check the pid of the dbwr process:
[Oracle @ hpserver2 dbs] $ ps-ef | grep dbw
Oracle 9451 1 0? 00:00:00 ora_dbw0_marven
[Oracle @ hpserver2 dbs] $ cd/proc/9451 [oracle @ hpserver2 ~] $ Cd/proc/9451/fd
[Oracle @ hpserver2 fd] $ ls-lrt
Total 0
Lrwx ------ 1 oracle oinstall 64 Jan 30->/u01/app/oracle/product/10.2.0/db_1/dbs/hc_marven.dat
L-wx ------ 1 oracle oinstall 64 Jan 30 :18 8->/u01/app/oracle/admin/marven/bdump/alert_marven
Lrwx ------ 1 oracle oinstall 64 Jan 30 7->/u01/app/oracle/product/10.2.0/db_1/dbs/lkinstmarven (deleted)
L-wx ------ 1 oracle oinstall 64 Jan 30>/u01/app/oracle/admin/marven/bdump/alert_marven.log
L-wx ------ 1 oracle oinstall 64 Jan 30 :18 5->/u01/app/oracle/admin/marven/udump/marven_ora_9443.trc
Lr-x ------ 1 oracle oinstall 64 Jan 30 4->/dev/null
Lr-x ------ 1 oracle oinstall 64 Jan 30 :18 3->/dev/null
Lr-x ------ 1 oracle oinstall 64 Jan 30 :18 24->/u01/app/oracle/product/10.2.0/db_1/rdbms/mesg/oraus. msb
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 23->/u01/app/oracle/oradata/marven/temp02.dbf (deleted)
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 22->/u01/app/oracle/oradata/marven/marven01.dbf (deleted)
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 21->/u01/app/oracle/oradata/marven/users01.dbf (deleted)
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 20->/u01/app/oracle/oradata/marven/sysaux01.dbf (deleted)
Lr-x ------ 1 oracle oinstall 64 Jan 30 17:18 2->/dev/null
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 19->/u01/app/oracle/oradata/marven/undotbs1.dbf (deleted)
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 18->/u01/app/oracle/oradata/marven/system01.dbf (deleted)
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 17->/u01/app/oracle/oradata/marven/control03.ctl
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 16->/u01/app/oracle/oradata/marven/control02.ctl
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 15->/u01/app/oracle/oradata/marven/control01.ctl
Lrwx ------ 1 oracle oinstall 64 Jan 30>/u01/app/oracle/product/10.2.0/db_1/dbs/lkMARVEN
Lrwx ------ 1 oracle oinstall 64 Jan 30 :18 13->/u01/app/oracle/product/10.2.0/db_1/dbs/hc_marven.dat
Lr-x ------ 1 oracle oinstall 64 Jan 30 :18 12->/dev/zero
Lr-x ------ 1 oracle oinstall 64 Jan 30 :18 11->/u01/app/oracle/product/10.2.0/db_1/rdbms/mesg/oraus.
Lr-x ------ 1 oracle oinstall 64 Jan 30>/dev/zero
Lr-x ------ 1 oracle oinstall 64 Jan 30 :18 1->/dev/null
Lr-x ------ 1 oracle oinstall 64 Jan 30 :18 0->/dev/null
 
Copy the data file back
[Oracle @ hpserver2 fd] $ cp 23/u01/app/oracle/oradata/marven/temp02.dbf
[Oracle @ hpserver2 fd] $ cp 22/u01/app/oracle/oradata/marven/marven01.dbf
[Oracle @ hpserver2 fd] $ cp 21/u01/app/oracle/oradata/marven/users01.dbf
[Oracle @ hpserver2 fd] $ cp 20/u01/app/oracle/oradata/marven/sysaux01.dbf
[Oracle @ hpserver2 fd] $ cp 19/u01/app/oracle/oradata/marven/undotbs1.dbf
[Oracle @ hpserver2 fd] $ cp 18/u01/app/oracle/oradata/marven/system01.dbf
 
Disable the instance and restore the media:
 
 
SQL> shutdown immediate
 
ORA-03113: end-of-file on communication channel
SQL> conn/as sysdba
Connected to an idle instance.
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
 
Total System Global Area 1610612736 bytes
Fixed Size 2084296 bytes
Variable Size 385876536 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14692352 bytes
Database mounted.
SQL> recover database;
Media recovery complete.
 
The database can be opened normally. Of course, since there are almost no transactions in this test database, you can do this without having to perform many replication operations.
SQL> alter database open;
 
Database altered.

From Jose Mourinho's column

Related Article

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.