我们大家都知道,数据库的服务器(本文以Oracle,非归档模式,把相关的软件安装于本地,把相关的Oracle控制文件放于本地,别的文件在相关的磁盘阵列)我们对其需要重做相关的OS,于是将Oracle相关的文件全部冷备到其他机器。
在拷贝数据文件的时候,system01.dbf出现一些问题,无法拷贝,于是再次打开数据库(在这之前,控制文件已经)检查了一下所有文件的状态,并没有查到什么原因导致system01.dbf无法拷贝。
当时的决定是:放弃冷备,OS重装后直接重装Oracle,然后导入数据恢复。比较幸运的是,OS重装后,磁盘阵列的卷信息居然都自动恢复了,将备份好的软件解tar,将控制文件也拷回,打开数据库时提示:Oracle控制文件比数据文件旧,无法打开。
恢复过程:
1、尝试使用旧的Oracle控制文件去恢复数据文件到一个比较旧的状态:
SQL>recoverdatabaseusingBACKUPCONTROLFILE; ORA-00279:??2734997(?03/09/201015:53:32??)????1???? ORA-00289:??:/opt/app/oracle/product/10.2.0/dbs/arch1_6_709571253.dbf ORA-00280:??2734997(????1)???#6?
指定日志: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
介质恢复已取消。
SQL>recoverdatabaseusingBACKUPCONTROLFILE; ORA-00279:??2734997(?03/09/201015:53:32??)????1???? ORA-00289:??:/opt/app/oracle/product/10.2.0/dbs/arch1_6_709571253.dbf ORA-00280:??2734997(????1)???#6?
指定日志: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
介质恢复已取消。
SQL>alterdatabaseopenresetlogs; alterdatabaseopenresetlogs *
第 1 行出现错误:
ORA-01113:??1?????? ORA-01110:????1:'/usr3/oradata1/sysdata/system01.dbf'
2、重建控制文件:
SQL>alterdatabasebackupcontrolfiletotrace;
在udump目录下找到相应的trc文件,先删除旧的控制文件,然后使用第二段重建Oracle控制文件的语句重建控制文件:
SQL> CREATE CONTROLFILE REUSE DATABASE "CRNOPHQ" RESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 1024
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 (
9 ‘/usr3/redo_log/redo01a.log’,
10 ‘/usr3/redo_log/redo01b.log’
11 ) SIZE 1024M,
12 GROUP 2 (
13 ‘/usr3/redo_log/redo02a.log’,
14 ‘/usr3/redo_log/redo02b.log’
15 ) SIZE 1024M,
16 GROUP 3 (
17 ‘/usr3/redo_log/redo03a.log’,
18 ‘/usr3/redo_log/redo03b.log’
19 ) SIZE 1024M
20 — STANDBY LOGFILE
21 DATAFILE
22 ‘/usr3/oradata1/sysdata/system01.dbf’,
23 ‘/usr3/oradata1/sysdata/undotbs01.dbf’,
24 ‘/usr3/oradata1/sysdata/sysaux01.dbf’,
25 ‘/usr3/oradata1/sysdata/users01.dbf’,
26 ‘/usr3/oradata1/sysdata/sysaux02.dbf’,
27 ‘/usr3/oradata1/sysdata/system02.dbf’,
28 ‘/usr3/oradata1/sysdata/undotbs02.dbf’,
29 ‘/usr3/oradata1/sysdata/undotbs03.dbf’,
30 ‘/usr3/oradata1/sysdata/undotbs04.dbf’,
31 ‘/usr3/oradata1/sysdata/users02.dbf’,
32 ‘/usr3/oradata1/data/dbs_d_crnophq01.dbf’,
33 ‘/usr3/oradata1/data/dbs_i_crnophq01.dbf’,
34 ‘/usr3/oradata3/data/dbs_d_perf01.dbf’,
35 ‘/usr3/oradata3/data/dbs_d_perf02.dbf’,
36 ‘/usr3/oradata3/data/dbs_d_perf03.dbf’,
37 ‘/usr3/oradata3/data/dbs_d_perf04.dbf’,
38 ‘/usr3/oradata3/data/dbs_d_perf05.dbf’,
39 ‘/usr3/oradata2/data/dbs_i_perf01.dbf’,
40 ‘/usr3/oradata2/data/dbs_i_perf02.dbf’,
41 ‘/usr3/oradata2/data/dbs_d_ne01.dbf’,
42 ‘/usr3/oradata2/data/dbs_d_ne02.dbf’,
43 ‘/usr3/oradata2/data/dbs_d_ne03.dbf’,
44 ‘/usr3/oradata2/data/dbs_d_ne04.dbf’,
45 ‘/usr3/oradata2/data/dbs_i_ne01.dbf’,
46 ‘/usr3/oradata2/data/dbs_i_ne02.dbf’,
47 ‘/usr3/oradata1/data/dbs_d_work01.dbf’,
48 ‘/usr3/oradata1/data/dbs_i_work01.dbf’,
49 ‘/usr3/oradata1/data/dbs_d_rnopoa01.dbf’,
50 ‘/usr3/oradata1/data/dbs_i_rnopoa01.dbf’,
51 ‘/usr3/oradata2/data/dbs_d_spatial01.dbf’,
52 ‘/usr3/oradata2/data/dbs_i_spatial01.dbf’,
53 ‘/usr3/oradata2/data/dbs_d_spatialmap01.dbf’,
54 ‘/usr3/oradata2/data/dbs_i_spatialmap01.dbf’
55 CHARACTER SET ZHS16GBK
56 ;
Oracle控制文件已创建。
SQL>alterdatabaseopenresetlogs;
数据库已更改。
SQL>selectstatus,instance_namefromv$instance; STATUSINSTANCE_NAME ---------------------------- OPENCRNOPHQ
至此,恢复完成。