技术开发 频道

只有rman的备份文件恢复过程

既然如此,我们就把控制文件同步下好了.

SQL> ho cp /opt/oracle/oradata/orcl/control01.ctl /opt/oracle/oradata/orcl/control02.ctl

SQL> ho cp /opt/oracle/oradata/orcl/control01.ctl /opt/oracle/oradata/orcl/control03.ctl

SQL> alter database mount;

Database altered.

SQL> ho ls /opt/oracle/oradata/orcl/

control01.ctl control02.ctl control03.ctl

好了到这里我们已经成功解决了难题2了.

有了恢复后的控制文件,我们就可以使用rman查看与使用以前的rman备份了.

恢复datafile 步骤:

rman target / nocatalog

Recovery Manager: Release 10.2.0.4 - Production on Fri Jul 18 21:49:10 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ORCL (DBID=1188209463, not open)

using target database control file instead of recovery catalog

RMAN>

看到了 红色部分了吗,太好了终于看到了正常的rman登陆信息了.

那就list copy|backup 看看能找到我们的

o1_mf_ncsnf_TAG20080718T203240_482fls2h_.bkp

o1_mf_nnndf_TAG20080718T203240_482fkb0k_.bkp

文件吗.

RMAN> list copy;

specification does not match any archive log in the recovery catalog

RMAN> list backup;

List of Backup Sets

===================

 BS Key Type LV Size Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ ---------------

1 Full 495.41M DISK 00:00:41 18-JUL-08

BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20080718T203240

Piece Name: /opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_nnndf_TAG20080718T203240_482fkb0k_.bkp

List of Datafiles in backup set 1

File LV Type Ckp SCN Ckp Time Name

---- -- ---- ---------- --------- ----

1 Full 453304 18-JUL-08 /opt/oracle/oradata/orcl/system01.dbf

2 Full 453304 18-JUL-08 /opt/oracle/oradata/orcl/undotbs01.dbf

3 Full 453304 18-JUL-08 /opt/oracle/oradata/orcl/sysaux01.dbf

4 Full 453304 18-JUL-08 /opt/oracle/oradata/orcl/users01.dbf

RMAN>

太好了,总于可以使用restore,recover来恢复datafile了.

RMAN> restore database;

Starting restore at 18-JUL-08

Starting implicit crosscheck backup at 18-JUL-08

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

Crosschecked 1 objects

Finished implicit crosscheck backup at 18-JUL-08

Starting implicit crosscheck copy at 18-JUL-08

using channel ORA_DISK_1

Finished implicit crosscheck copy at 18-JUL-08

searching for all files in the recovery area

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_ncsnf_TAG20080718T203240_482fls2h_.bkp

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /opt/oracle/oradata/orcl/system01.dbf

restoring datafile 00002 to /opt/oracle/oradata/orcl/undotbs01.dbf

restoring datafile 00003 to /opt/oracle/oradata/orcl/sysaux01.dbf

restoring datafile 00004 to /opt/oracle/oradata/orcl/users01.dbf

channel ORA_DISK_1: reading from backup piece /opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_nnndf_TAG20080718T203240_482fkb0k_.bkp

channel ORA_DISK_1: restored backup piece 1

piece handle=/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_nnndf_TAG20080718T203240_482fkb0k_.bkp tag=TAG20080718T203240

channel ORA_DISK_1: restore complete, elapsed time: 00:00:56

Finished restore at 18-JUL-08

RMAN>

此时可以在$ORACLE_BASE/oradata/orcl/下看到期望已久的datafile了.

[oracle@foway dbs] ls /opt/oracle/oradata/orcl/

control01.ctl control02.ctl control03.ctl sysaux01.dbf system01.dbf undotbs01.dbf users01.dbf

[oracle@foway dbs]

不过此时还没有完哈,需要在接在励.

由于没有redo log日志文件所以我们不应用日志恢复:

RMAN> recover database noredo;

Starting recover at 18-JUL-08

using channel ORA_DISK_1

Finished recover at 18-JUL-08

RMAN>

到目前我们已经拥有了参数文件,控制文件,数据文件了:

[oracle@foway dbs] ls /opt/oracle/oradata/orcl/

ls /opt/oracle/oradata/orcl/

control01.ctl control02.ctl control03.ctl sysaux01.dbf system01.dbf

undotbs01.dbf users01.dbf

[oracle@foway dbs] ls /opt/oracle/10g/dbs/

alert_orcl.log hc_orcl.dat initdw.ora init.ora lkORCL spfileorcl.ora

还差一个密码文件,以及相关的日志文件了.

先解决密码文件:

[oracle@foway dbs] orapwd file=/opt/oracle/10g/dbs/orapworcl password=uplooking entries=5

[oracle@foway dbs] ls /opt/oracle/10g/dbs/

ls /opt/oracle/10g/dbs/

alert_orcl.log initdw.ora lkORCL spfileorcl.ora

hc_orcl.dat init.ora orapworcl

下面需要大家坚持不懈的完成最后一个工作了.

通过已经恢复的controlfile and datafile 来演算出redo log file了.

步骤:

[oracle@foway dbs]sqlplus /nolog

SQL*Plus: Release 10.2.0.4 - Production on Fri Jul 18 21:58:05 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> conn /as sysdba

Connected.

SQL> startup force mount

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1218316 bytes

Variable Size 62916852 bytes

Database Buffers 100663296 bytes

Redo Buffers 2973696 bytes

Database mounted.

SQL>alter system set "_allow_resetlogs_corruption"=TRUE;

alter system set "_allow_resetlogs_corruption"=TRUE

*

ERROR at line 1:

ORA-02095: specified initialization parameter cannot be modified

SQL> alter system set "_allow_resetlogs_corruption"=TRUE scope=spfile;

System altered.

SQL>ho ls /opt/oracle/oradata/orcl/

control01.ctl control03.ctl sysaux01.dbf undotbs01.dbf

control02.ctl orapworcl system01.dbf users01.dbf

下面没有redo log file ,下面我将演算出redo log

SQL>startup force

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1218316 bytes

Variable Size 62916852 bytes

Database Buffers 100663296 bytes

Redo Buffers 2973696 bytes

Database mounted.

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL>alter database open resetlogs;

Database altered.

SQL> ho ls /opt/oracle/oradata/orcl/

control01.ctl orapworcl redo03.log temp01.dbf

control02.ctl redo01.log sysaux01.dbf undotbs01.dbf

control03.ctl redo02.log system01.dbf users01.dbf

SQL>

好了到这里,非常高兴了,你已经成功的从只有rman备份文件中恢复了参数文件,控制文件,所有数据文件,日志文件了. 

Created by foway in uplooking.com 2008
 

0
相关文章