由于自己本地使用的virtual-box虚拟机,在虚拟机上安装Oracle,物理机偶尔会因为内存问题无响应,就强制断电重启,没想到虚拟机非常规关机导致oracle ORA-01200&ORA-01110&ORA-01122
启动数据库时报错:
[oracle@oratest ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 6 11:32:03 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2257880 bytes
Variable Size 545262632 bytes
Database Buffers 289406976 bytes
Redo Buffers 2355200 bytes
Database mounted.
ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: '/oradata/oracle/oradata/oradb/sysaux01.dbf'
ORA-01200: actual file size of 62720 is smaller than correct size of 66560 blocks
报错提示数据库记录 /oradata/oracle/oradata/oradb/sysaux01.dbf的大小是66560而实际大小是62720,此种报错有个简单的解决方法,就是通过dd修改报错相关的数据文件,改成数据库期望的大小,瞒过oracle:
SQL> select 66560 - 62720 from dual;
66560-62720
-----------
3840
SQL> !dd if=/dev/zero of=/oradata/oracle/oradata/oradb/sysaux01.dbf bs=8192 count=3840 seek=62721 --bs是数据库块大小,count是差值,seek是从哪开始填充0
3840+0 records in
3840+0 records out
31457280 bytes (31 MB) copied, 0.02607 seconds, 1.2 GB/s
SQL> alter database open;
Database altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2257880 bytes
Variable Size 545262632 bytes
Database Buffers 289406976 bytes
Redo Buffers 2355200 bytes
Database mounted.
Database opened.
SQL> select count(*) from dba_users;
COUNT(*)
----------
30
SQL> select count(*) from dba_data_files;
COUNT(*)
----------
4
SQL>
处理后数据库能正常打开、关闭、重启了。
启动数据库时报错:
[oracle@oratest ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 6 11:32:03 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2257880 bytes
Variable Size 545262632 bytes
Database Buffers 289406976 bytes
Redo Buffers 2355200 bytes
Database mounted.
ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: '/oradata/oracle/oradata/oradb/sysaux01.dbf'
ORA-01200: actual file size of 62720 is smaller than correct size of 66560 blocks
报错提示数据库记录 /oradata/oracle/oradata/oradb/sysaux01.dbf的大小是66560而实际大小是62720,此种报错有个简单的解决方法,就是通过dd修改报错相关的数据文件,改成数据库期望的大小,瞒过oracle:
SQL> select 66560 - 62720 from dual;
66560-62720
-----------
3840
SQL> !dd if=/dev/zero of=/oradata/oracle/oradata/oradb/sysaux01.dbf bs=8192 count=3840 seek=62721 --bs是数据库块大小,count是差值,seek是从哪开始填充0
3840+0 records in
3840+0 records out
31457280 bytes (31 MB) copied, 0.02607 seconds, 1.2 GB/s
SQL> alter database open;
Database altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2257880 bytes
Variable Size 545262632 bytes
Database Buffers 289406976 bytes
Redo Buffers 2355200 bytes
Database mounted.
Database opened.
SQL> select count(*) from dba_users;
COUNT(*)
----------
30
SQL> select count(*) from dba_data_files;
COUNT(*)
----------
4
SQL>
处理后数据库能正常打开、关闭、重启了。