|
备份恢复 | Oracle | 771 次查看 |
|---|---|---|
|
||
前提: 1. 需要有除丢失文件以外其他文件的备份. 2. 丢失的文件需要是在其他文件备份后创建的. 3. 所有其他文件备份后的归档都在存在 恢复步骤: 1,拷贝任一未丢失文件的备份回来 2.创建新控制文件,但控制文件不包括丢失的数据文件 3.进行恢复 4.碰到 ORA-00283: recovery session canceled due to errors ORA-01244: unnamed datafile(s) added to controlfile by media recovery ORA-01110: data file 3: 'D:\ORACLE\ORADATA\xxxx\xxxx.DBF' 5.select name from v$datafile找出uname file 6. alter database create datafile 'D:\ORACLE\ORA92\DATABASE\UNNAMEDxxxxx' as 'D:\ORACLE\ORADATA\ xxxx\xxxx.DBF '; 7.继续恢复 8.恢复完成,打开. 可能会遇到的问题: 1.如果没有拷贝备份回来直接重建不包含丢失文件的控制文件时,可以打开数据库,但丢失的文件会显示成missingxxxx的file name,这时候就会不能恢复. 试验过程: Microsoft Windows XP [版本 5.1.2600] (C) 版权所有 1985-2001 Microsoft Corp. C:\Documents and Settings\qigong>oradim -startup -sid test C:\Documents and Settings\qigong>sqlplus / as sysdba SQL*Plus: Release 10.1.0.2.0 - Production on 星期三 8月 25 15:22:39 2004 Copyright (c) 1982, 2004, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production With the Partitioning, OLAP and Data Mining options SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Producti With the Partitioning, OLAP and Data Mining options C:\Documents and Settings\qigong>sqlplus / as sysdba SQL*Plus: Release 10.1.0.2.0 - Production on 星期三 8月 25 15:25:37 2004 Copyright (c) 1982, 2004, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount; ORACLE instance started. Total System Global Area 163577856 bytes Fixed Size 787948 bytes Variable Size 74447380 bytes Database Buffers 88080384 bytes Redo Buffers 262144 bytes SQL> alter database mount; alter database mount * ERROR at line 1: ORA-00205: error in identifying controlfile, check alert log for more info SQL> shutdown ORA-01507: database not mounted ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 163577856 bytes Fixed Size 787948 bytes Variable Size 74447380 bytes Database Buffers 88080384 bytes Redo Buffers 262144 bytes Database mounted. Database opened. SQL> alter system switch logfile; System altered. SQL> / System altered. SQL> / System altered. SQL> create tablespace test2 2 datafile 'c:\test2.dbf' size 10m 3 extent management local 4 segment space management auto 5 uniform size 100k; Tablespace created. SQL> insert into testlost values(2); 1 row created. SQL> commit; Commit complete. SQL> create table testlost2(a number) tablespace test2; Table created. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area 163577856 bytes Fixed Size 787948 bytes Variable Size 74447380 bytes Database Buffers 88080384 bytes Redo Buffers 262144 bytes C:\Documents and Settings\qigong>rman | ||