首页 » ORACLE 9i-23ai » Troubleshooting Oracle open database 报错ORA-01122 ORA-01110 ORA-01200

Troubleshooting Oracle open database 报错ORA-01122 ORA-01110 ORA-01200

近期一个客户在vm环境外挂虚拟共享盘部署的oracle,类似AIX双机主备, 近期1主机异常hang死,另一主机启动数据库报错如下

ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: ‘/oradata/anbob/sysaux01.dbf’
ORA-01200: actual file size of 1990400 is smaller than correct size of 2064640 blocks

[oracle@ANBOB ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 27 10:05:36 2023
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@anbob>alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01100: database already mounted


SYS@anbob>alter database open;
alter database open
*
ERROR at line 1:
ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: '/oradata/anbob/sysaux01.dbf'
ORA-01200: actual file size of 1990400 is smaller than correct size of 2064640 blocks

$ oerr ora 1200
01200, 00000, "actual file size of %s is smaller than correct size of %s blocks"
// *Cause:  The size of the file as returned by the operating system is smaller
//         than the size of the file as indicated in the file header and the
//         control file. Somehow the file has been truncated. Maybe it is the
//         result of a half completed copy.
// *Action: Restore a good copy of the data file and do recovery as needed.

Note:
操作系统的文件大小小于文件头和controlfile,通常是断电、文件系统满被截断等原因,实际操作系统文件大小1990400 blocks, 而文件头记录的是2064640 blocks。

非归档模式无备份,且文件是sysaux表空间,影响相对较小。如果有备份可以尝试从rman备份恢复, 如果无备份可以使用dd 补空或修改文件头异常恢复方式。操作前建议做冷备份。

ORA-01200: actual file size of 1990400 is smaller than correct size of 2064640 blocks

OS size

blocks* block size +1 oracle block 。

SYS@anbob>select 1990400*8192+8192 from dual;

1990400*8192+8192
-----------------
      16305364992

[oracle@ANBOB ~]$ ls -l /oradata/anbob/sysaux01.dbf
-rw-r-----. 1 oracle oinstall 16305364992  4�� 20 10:54 /oradata/anbob/sysaux01.dbf

与文件头差异

# 差 blocks
SYS@anbob>select 2064640-1990400 from dual;
 2064640-1990400
----------------
           74240

# 差 bytes
SYS@anbob>select 74240*8192 from dual;

      74240*8192
----------------
       608174080

# file header size
SYS@anbob>select 2064640*8192+8192 from dual;

2064640*8192+8192
-----------------
      16913539072

补空恢复

# 备份
[oracle@ANBOB anbob]$ cp sysaux01.dbf sysaux01.dbf_bak
# dd if=<locationf datafile having problem> of=<output/target datafile> count=<actual file size of blocks> bs=<db_block_size in bytes>

[oracle@ANBOB anbob]$ dd if=/oradata/anbob/sysaux01.dbf of=/oradata/anbob/sysaux01.dbf_dd count=1990400 bs=8192

[oracle@ANBOB anbob]$ ls -l sysaux01.dbf*
-rw-r-----. 1 oracle oinstall 16305364992  4�� 20 10:54 sysaux01.dbf
-rw-r-----  1 oracle oinstall 16305364992  6�� 27 10:25 sysaux01.dbf_bak
-rw-r--r--  1 oracle oinstall 16305356800  6�� 27 10:29 sysaux01.dbf_dd

补空

$ dd if=/dev/zero of=<location of datafile> bs=<db_block_size in bytes> seek=<Actual block number reported + 1 > count=<Difference in number of block>
 
[oracle@ANBOB anbob]$ dd if=/dev/zero of=/oradata/anbob/sysaux01.dbf bs=8192 seek=1990401 count=74240 conv=notrunc 
74240+0 records in
 74240+0 records out 
608174080 bytes (608 MB) copied, 0.715885 s, 850 MB/s
 [oracle@ANBOB anbob]ls -l /oradata/anbob/sysaux01.dbf
 -rw-r-----. 1 oracle oinstall 16913539072 Jun 27 10:35 /oradata/anbob/sysaux01.dbf

启动数据库

[oracle@ANBOB ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 27 10:39:19 2023

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@anbob>alter database open;
Database altered.

不建议使用这个方法修复system数据文件,如果原来的数据文件有对象可能会数据丢失,在数据库打开后建议逻辑导出,重建数据库。在后续DBV校验时会认为DD的块为坏块,如果之前不属于其它segmetn但可以重新格式化使用。

 

使用BBED修复的方法

# set file#, block#, offset 44

BBED> set dba 2,1 offset 44
BBED> p
kcvfh.kcvfhhdr.kccfhfs

#  set kccfhfsz = actual file size of 1990400
BBED> assign kcvfh.kcvfhhdr.kccfhfsz=0x1E5F00

BBED> sum apply

— enjoy —

打赏

,

对不起,这篇文章暂时关闭评论。