数据库主机异常重启,遭遇ORA-01200: actual file size of 4 is smaller than correct size of 128 blocks
查看ora-01200报错是什么意思
oracle@test1:/home/oracle$ 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.
oracle@test1:/home/oracle$
根据报错信息,是控制文件记录的信息比实际上从操作系统中得到的文件大小不同。实际文件大小必控制文件记录的小。
1、查询控制文件记录的文件大小:为1M。
select file#,status,bytes/1024/1024 ,name from v$datafile;
2、查看操作系统上文件的大小为40K。
3、dump数据文件头的信息
alter session set events 'immediate trace name FILE_HDRS level 10';
查看trace文件
4、如果有备份可以使用备份进行恢复。但是如果没有备份,该如何恢复呢?
方法一:
通过bbed工具,把数据文件构造到和控制文件记录的一模一样来骗过oracle。
1、bbed parfile=bbed.par
2、修改数据文件大小为4
3、open数据库
4、此时查看数据文件的大小
方法二:
1、使用dd命令在数据文件结尾添加124个块,使数据库达到1280个,一次骗过Oracle。
dd if=/dev/zero of=/u01/oradata/orcl/test_ind01.dbf bs=8192 seek=1280 count=124
2、open数据库
SQL> alter database open;
Database altered.
SQL>