oracle冷备份无法启动

2019-03-12

数据库硬盘坏了,有rsync复制的没有shutdown的冷备份。

1、但是启动时报错:SQL> alter database open ;

ERROR at line 1:
ORA-01113: file 1 needs media recovery if it was restored from backup, or END
BACKUP if it was not
ORA-01110: data file 1: '/u02/oracle/oradata/dydb/system01.dbf'

2、正常的db,你查询如下几个值都是一样的:

select checkpoint_change# from v$database;   --来自controlfile
select checkpoint_change# from v$datafile;   --来自controlfile
select checkpoint_change# from v$datafile_orader;  --来自datafile header
其实,通常来讲,只要上述几个值一样,那么我们的db应该都是可以直接open打开的

3、如果仅仅是ctl和dbf文件scn不一致,我们可以重建控制文件恢复
主导思想:创建控制文件,然后open数据库。

4、具体步骤:
a.startup mount
b.alter database backup controlfile to trace;

c.根据/u02/oracle/mydb/udump/dydb_ora_13291.trc
create a control file creation script from the trace file,
and use the noresetlogs option

SQL>shutdown abort

cd $ORACLE_BASE/oradata/mydb

rm *.ctl删除控制文件
SQL>@create.sql 会启动到mount模式,重建3个控制文件

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "MYDB" NORESETLOGS  NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 922
LOGFILE
GROUP 1 '/u02/oracle/oradata/mydb/redo01.log'  SIZE 50M,
GROUP 2 '/u02/oracle/oradata/mydb/redo02.log'  SIZE 50M,
GROUP 3 '/u02/oracle/oradata/mydb/redo03.log'  SIZE 50M
DATAFILE
'/u02/oracle/oradata/mydb/system01.dbf',
'/u02/oracle/oradata/dydb/undotbs01.dbf',
'/u02/oracle/oradata/dydb/sysaux01.dbf',
'/u02/oracle/oradata/dydb/users01.dbf',
'/data1/oracle/talk99_crm_ts_2015_1.dbf',
'/data1/oracle/db_crm_201110_1.dbf',
'/data1/oracle/db_other_201110_1.dbf',
'/data1/oracle/db_test_201403_2.dbf'
CHARACTER SET ZHS16GBK
;

select open_mode from v$database;

SQL> recover database;
Media recovery complete.
SQL> alter database open ;

Database altered.

ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oracle/oradata/dydb/temp01.dbf' REUSE;

如果数据库不能启动了,继续查日志,确定原因。

d.shutdown abort
e.startup nomount
Use the script generated by the 'backup controlfile to trace' command above
creaet the control file
f.recover database
g.alter database open

h.alter database open resetlogs;

ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent 需要更多的恢复来保持一致性 解析
ORA-01110: data file 1: '/u02/oracle/oradata/dydb/system01.dbf'

5、归档模式下然后根据情况,指定archive log和redo file。
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 9617065337 generated at 12/28/2018 22:19:50 needed for thread
1
ORA-00289: suggestion :
/u02/oracle/flash_recovery_area/DYDB/archivelog/2019_03_11/o1_mf_1_40350_%u_.arc
ORA-00280: change 9617065337 for thread 1 is in sequence #40350

分类:数据库 | 标签: |

相关日志

评论被关闭!