Data File recovery for Oracle Database RMAN recovery

Source: Internet
Author: User

OracleDatabaseREAN recoveryOfData File recoveryThis is what we will introduce in this article. We know that apart from the system tablespace data file mount, other data files can be restored in the open (mount) state. Restoring data files in the open state can reduce the database downtime, so you should restore these data files in the open state.

Example 1: the data file is deleted by mistake.

Delete non-system tablespace data files when the database is closed.

Start the database to the mount status.

For offline data files, alter database datafile n offline.

Open the database and alter database open.

Dump the data file, restore datafile n.

Use recover datafile n to archive logs.

Online data file: alter database datafile n online.

-- Delete non-system tablespace data files when the database is closed.

 
 
  1. [Oracle @ localhost ~] $ Rm $ ORACLE_BASE/product/10.2.0/oradatabak/example01.dbf;
  2. SQL> select file #, error from v $ recover_file;
  3. FILE # ERROR
  4. ---------------------------------------------------------------------------
  5. 5 FILE NOT FOUND
  6. SQL> select file #, name from v $ datafile where file # = 5;
  7. FILE # NAME
  8. ------------------------------------------------------------------------------------------
  9. 5/oracle/10g/oracle/product/10.2.0/oradatabak/example01.dbf
  10. -- Restore data files
  11. RMAN> run {
  12. Startup force mount;
  13. SQL 'alter database datafile 5 offline ';
  14. SQL 'alter database open ';
  15. Restore datafile 5;
  16. Recover datafile 5;
  17. SQL 'alter database datafile 5 online ';
  18. 8>}

Example 2: the disk where the data file is located is damaged

Delete non-system tablespace data files when the database is closed.

Start the database to the mount status.

For offline data files, alter database datafile n offline.

Open the database and alter database open.

Before restore database, run set newname to specify a new location for the data file.

After the restore database, Run switch datafile to change the location and name of the data file in the control file.

Then, archive logs by executing the recover database application.

Online data file: alter database datafile n online.

-- Delete non-system tablespace data files when the database is closed.

 
 
  1. [Oracle @ localhost ~] $ Rm $ ORACLE_BASE/product/10.2.0/oradatabak/example01.dbf;
  2.  
  3. SQL> select file #, error from v $ recover_file;
  4.  
  5. FILE # ERROR
  6.  
  7. ---------------------------------------------------------------------------
  8.  
  9. 5 FILE NOT FOUND
  10.  
  11. SQL> select file #, name from v $ datafile where file # = 5;
  12.  
  13. FILE # NAME
  14.  
  15. ------------------------------------------------------------------------------------------
  16.  
  17. 5/oracle/10g/oracle/product/10.2.0/oradatabak/example01.dbf
  18.  
  19. -- Restore data files
  20.  
  21. [Oracle @ localhost ~] $ Rman target sys/oracle @ oralife nocatalog
  22.  
  23. RMAN> run {
  24.  
  25. 2> startup force mount;
  26.  
  27. 3> SQL 'alter database datafile 5 offline ';
  28.  
  29. 4> SQL 'alter database open ';
  30.  
  31. 5> set newname for datafile 5 to '$ ORACLE_BASE/product/10.2.0/oradata/oralife/example01.dbf ';
  32.  
  33. 6> restore datafile 5;
  34.  
  35. 7> switch datafile 5;
  36.  
  37. 8> recover datafile 5;
  38.  
  39. 9> SQL 'alter database datafile 5 online ';
  40.  
  41. 10>}
  42.  
  43. SQL> select file #, name from v $ datafile where file # = 5;
  44.  
  45. FILE # NAME
  46.  
  47. ------------------------------------------------------------------------------------------
  48.  
  49. 5/oracle/10g/oracle/product/10.2.0/oradata/oralife/example01.dbf
  50.  
  51. SQL> select file #, error from v $ recover_file;
  52.  
  53. No rows selected

Here is an introduction to the restoration of data files recovered by Oracle Database RMAN. I hope this introduction will be helpful to you!

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.