Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Restored data files for recovery

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The first step in restoring from a backup is to restore data files from the backup.

The action of restoring the data file is very simple, which is to use the operating system command to copy the backup data file to the location of the data file. What needs to be paid attention to is the preparatory action of this action.

You need to first determine which data files need to be restored, and then determine the appropriate backup, which is usually the most recent backup, but may also need to be restored from a previous backup.

In the following steps, in order to simulate the corruption of the data file when the database is open, Ultraedit is used to modify the data file of the USERS tablespace.

SQL > SELECT COUNT (*) FROM TEST

SELECT COUNT (*) FROM TEST

*

ERROR is on line 1:

ORA-00376: cannot read file 5 at this time

ORA-01110: data file 5: 'forward ORACLEORADATESTUSERS01.DBF'

First query the V$RECOVER_FILE view, which will include the name of the data file to be restored and the error type of the already data file. Note that control files recovered from a backup or recreated through CREATE CONTROLFILE do not contain information about corrupted data files.

SQL > SELECT * FROM V$RECOVER_FILE

FILE# ONLINE ONLINE_ ERROR CHANGE# TIME

--

5 OFFLINE OFFLINE CORRUPT HEADER 1109606706 2006-02-08 02:05:11

Then determine the physical location of the data file:

SQL > SELECT D.NAME, T.NAME AS TABLESPACE_NAME

2 FROM V$DATAFILE D, V$TABLESPACE T

3 WHERE T.TS# = D.TS#

4 AND D.FILE# = 5

NAME TABLESPACE_NAME

F:ORACLEORADATATESTUSERS01.DBF USERS

Because the database is open, first take the tablespace offline:

SQL > ALTER TABLESPACE USERS OFFLINE IMMEDIATE

The tablespace has changed.

SQL > HOST COPY F:ORACLEBACKUPTEST20060207USERS01.DBF F:ORACLEORADATATESTUSERS01.DBF

SQL > RECOVER TABLESPACE USERS

Complete the media recovery.

SQL > ALTER TABLESPACE USERS ONLINE

The tablespace has changed.

SQL > SELECT COUNT (*) FROM TEST

COUNT (*)

-

6288

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 271

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report