oracle实验中的错误,【案例】Oracle报错ORA-01190的产生原因和2种官方解决办法

本文介绍了Oracle数据库在宕机后出现数据文件SCN不一致的问题,导致ORA-01190错误。通过官方文档,文章详细展示了两种修复方法:一是通过增加SCN值,二是利用bbed工具修改resetlog SCN。同时,文章提供了具体的SQL命令和故障处理步骤,帮助读者理解并解决此类问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

【案例】Oracle报错ORA-01190的产生原因和2种官方解决办法

时间:2016-10-21 19:34   来源:Oracle研究中心   作者:HTZ   点击:

天萃荷净

运维DBA反映生产环境数据库在宕机后数据文件的SCN不一致并报错ORA-01190.总结出两种方法来修复数据文件头SCN不一致的方法。

ORA-01190这个错误比较常见.特别在没有正规DBA运维的环境中比较常见.

先看看ORACLE官方是怎么解决这个报错的

SQL> !oerr ora 01190

01190, 00000, “control file or data file %s is from before the last RESETLOGS”

// *Cause: Attempting to use a data file when the log reset information in

// the file does not match the control file. Either the data file

// or the control file is a backup that was made before the most

// recent ALTER DATABASE OPEN RESETLOGS.

// *Action: Restore file from a more recent backup.

1.数据库的版本

SQL> select * from v$version;

BANNER

——————————————————————————–

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production

PL/SQL Release 11.2.0.4.0 – Production

CORE 11.2.0.4.0 Production

TNS for Linux: Version 11.2.0.4.0 – Production

NLSRTL Version 11.2.0.4.0 – Production

2.现象模拟

这里我们通过使用online一个数据文件后.使用open resetlogs方式来打开数据库.这样offline的数据文件就成功resetlogs之间的数据文件.实验环境要求数据库运行在归档模式.其它非归档模式也是一样的.只是需要再侯scn的值

SQL> drop tablespace htz including contents and datafiles;

Tablespace dropped.

SQL> select name from v$dbfile where rownum=1;

NAME

——————————————————————————–

/oracle/app/oracle/oradata/orcl1124/users01.dbf

SQL> create tablespace htz datafile ‘/oracle/app/oracle/oradata/orcl1124/htz01.dbf’ size 10m autoextend on maxsize 10G;

Tablespace created.

SQL> create table scott.htz tablespace htz as select * from dba_objects;

Table created.

SQL> startup mount;

ORACLE instance started.

Total System Global Area 379965440 bytes

Fixed Size 2253464 bytes

Variable Size 171969896 bytes

Database Buffers 201326592 bytes

Redo Buffers 4415488 bytes

Database mounted.

SQL> alter database archivelog;

Database altered.

SQL> !rm /tmp/control.txt

SQL> alter database backup controlfile to trace as ‘/tmp/control.txt’;

Database altered.

SQL> shutdown immediate;

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL> startup nomount;

ORACLE instance started.

Total System Global Area 379965440 bytes

Fixed Size 2253464 bytes

Variable Size 171969896 bytes

Database Buffers 201326592 bytes

Redo Buffers 4415488 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE “ORCL1124” RESETLOGS ARCHIVELOG

2 MAXLOGFILES 16

3 MAXLOGMEMBERS 3

4 MAXDATAFILES 100

5 MAXINSTANCES 8

6 MAXLOGHISTORY 292

7 LOGFILE

8 GROUP 1 ‘/oracle/app/oracle/oradata/orcl1124/redo01.log’ SIZE 50M BLOCKSIZE 512,

9 GROUP 2 ‘/oracle/app/oracle/oradata/orcl1124/redo02.log’ SIZE 50M BLOCKSIZE 512,

10 GROUP 3 ‘/oracle/app/oracle/oradata/orcl1124/redo03.log’ SIZE 50M BLOCKSIZE 512

11 — STANDBY LOGFILE

12 DATAFILE

13 ‘/oracle/app/oracle/oradata/orcl1124/system01.dbf’,

14 ‘/oracle/app/oracle/oradata/orcl1124/sysaux01.dbf’,

15 ‘/oracle/app/oracle/oradata/orcl1124/undotbs01.dbf’,

16 ‘/oracle/app/oracle/oradata/orcl1124/users01.dbf’,

17 ‘/oracle/app/oracle/oradata/orcl1124/htz01.dbf’

18 CHARACTER SET ZHS16GBK

19 ;

Control file created.

SQL> set lines 200

SQL> col name for a60

SQL> select * from v$dbfile;

FILE# NAME

———- ————————————————————

5 /oracle/app/oracle/oradata/orcl1124/htz01.dbf

4 /oracle/app/oracle/oradata/orcl1124/users01.dbf

3 /oracle/app/oracle/oradata/orcl1124/undotbs01.dbf

2 /oracle/app/oracle/oradata/orcl1124/sysaux01.dbf

1 /oracle/app/oracle/oradata/orcl1124/system01.dbf

SQL> alter database datafile 5 offline;

Database altered.

SQL> recover database using backup controlfile until cancel;

ORA-00279: change 1277201 generated at 04/22/2014 18:06:17 needed for thread 1

ORA-00289: suggestion : /oracle/app/oracle/fast_recovery_area/ORCL1124/archivelog/2014_04_22/o1_mf_1_90_%u_.arc

ORA-00280: change 1277201 for thread 1 is in sequence #90

Specify log: {=suggested | filename | AUTO | CANCEL}

cancel

Media recovery cancelled.

SQL> alter database open resetlogs;

Databas

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值