Recovery of lost data files after normal Shutdown Without backup in the Archiving mode of the RMAN Experiment

Source: Internet
Author: User

Not all data file loss can be directly restored, such as system. Not all data file loss needs to be restored, such as temp tablespace.

A business table is simulated below.

1. Create a demo Environment

sys@ORCL> archive log list;Database log mode              Archive ModeAutomatic archival             EnabledArchive destination            USE_DB_RECOVERY_FILE_DESTOldest online log sequence     16Next log sequence to archive   18Current log sequence           18sys@ORCL> create tablespace think datafile '/u01/app/oracle/oradata/ORCL/datafile/think.dbf' size 10m;Tablespace created.sys@ORCL> create user think identified by think default tablespace think quota unlimited on think;User created.sys@ORCL> grant connect,resource to think;Grant succeeded.sys@ORCL> conn think/thinkConnected.think@ORCL> create table tt (name varchar2(20));Table created.think@ORCL> insert into tt values('think');1 row created.think@ORCL> commit;Commit complete.think@ORCL> select * from tt;NAME--------------------think

2. Simulate data file loss

Sys @ orcl> shutdown immediate; database closed. database dismounted. oracle instance shut down. sys @ orcl> host Rm-RF/u01/APP/Oracle/oradata/orcl/datafile/think. DBF restarts Database SYS @ orcl> startuporacle instance started. total system global area 419430400 bytesfixed size 1219760 bytesvariable size 125829968 bytesdatabase buffers 289406976 bytesredo buffers 2973696 bytesdatabase mounted. ORA-01157: cannot identify/lock data file 8-see dbwr trace fileORA-01110: Data File 8: '/u01/APP/Oracle/oradata/orcl/datafile/think. dbf'

******* ****************

3. Perform Repair and recovery

sys@ORCL> alter database create datafile '/u01/app/oracle/oradata/ORCL/datafile/think.dbf';Database altered.sys@ORCL> recover datafile 8;Media recovery complete.

4. query data

sys@ORCL> alter database open;Database altered.sys@ORCL> conn think/thinkConnected.think@ORCL> select * from tt;NAME--------------------think

* ***************************** RMAN recovery ********* *************

 

[oracle@localhost ~]$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Tue Aug 7 00:03:44 2012Copyright (c) 1982, 2005, Oracle.  All rights reserved.connected to target database: ORCL (DBID=1316499950, not open)RMAN> restore datafile 8;Starting restore at 07-AUG-12using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=155 devtype=DISKcreating datafile fno=8 name=/u01/app/oracle/oradata/ORCL/datafile/think.dbfrestore not done; all files readonly, offline, or already restoredFinished restore at 07-AUG-12RMAN> recover datafile 8;Starting recover at 07-AUG-12using channel ORA_DISK_1starting media recoverymedia recovery complete, elapsed time: 00:00:03Finished recover at 07-AUG-12RMAN> alter database open;database openedsys@ORCL> conn think/thinkConnected.think@ORCL> select * from tt;NAME--------------------think

Summary: The key to restoring a lost data file is that all the redo log files are still in progress from the creation time, so we can recreate the data file, use the recover command to apply all the redo logs to reconstruct the content of the data file.

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.