Restoration of tablespace and data block media in Oracle Database RMAN recovery

Source: Internet
Author: User

Example 1: The tablespace data file is deleted by mistake.
Delete all data files corresponding to the tablespace in the open state.
Use alter tablespace... offline for recover offline tablespace in the open state.
Use restore tablespace... to dump all data files in the tablespace.
Use recover tablespace... to archive logs.
Finally, use alter tablespace... online to bring the tablespace online.
-- Delete all data files corresponding to the tablespace in the open state.
[Oracle @ localhost ~] $ Rm/oracle/10g/oracle/product/10.2.0/oradatabak/users01.dbf;
-- Restore tablespace
[Oracle @ localhost ~] $ Rman target sys/oracle @ oralife nocatalog
RMAN> run {
2> SQL 'alter tablespace users offline for recover ';
3> restore tablespace users;
4> recover tablespace users;
5> SQL 'alter tablespace users online ';
6>}
Example 2: the disk where the tablespace data file is located is faulty
Delete all data files corresponding to the tablespace in the open state.
Use alter tablespace... offline for recover offline tablespace in the open state.
Run set newname to specify a new location for the data file.
Use restore tablespace... to dump all data files in the tablespace.
Run switch datafile to change the location and name of the data file in the control file.
Use recover tablespace... to archive logs.
Finally, use alter tablespace... online to bring the tablespace online.
-- Delete all data files corresponding to the tablespace in the open state.
[Oracle @ localhost ~] $ Rm/oracle/10g/oracle/product/10.2.0/oradatabak/users01.dbf;
SQL> select * from t_user;
Select * from t_user
*
ERROR at line 1:
ORA-00376: file 4 cannot be read at this time
ORA-01110: data file 4:
'/Oracle/10g/oracle/product/10.2.0/oradatabak/users01.dbf'
SQL> select file #, error from v $ recover_file;
FILE # ERROR
---------------------------------------------------------------------------
4 FILE NOT FOUND
-- Restore tablespace
[Oracle @ localhost ~] $ Rman target sys/oracle @ oralife nocatalog
Run {
SQL 'alter tablespace users offline for recover ';
Set newname for datafile 4 to '$ ORACLE_BASE/product/10.2.0/oradata/oralife/user01.dbf ';
Restore tablespace users;
Switch datafile all;
Recover tablespace users;
SQL 'alter tablespace users online ';
}
-- Recovered
SQL> select * from t_user;
TEXT
--------------------
Java _
SQL> select name from v $ datafile where file # = 4;
NAME
--------------------------------------------------------------------------------
/Oracle/10g/oracle/product/10.2.0/oradata/oralife/user01.dbf
Data Block Media recovery
If some data blocks in the data file are damaged, use the blockrecover command to restore the damaged data blocks.
For example:
RMAN> blockrecover device type disk
2> datafile 5 blocks, 88;
We will introduce the restoration methods for tablespace and data block media in Oracle Database RMAN recovery. We hope this introduction will help you.

Author: "oracle certification value"

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.