1.SQL>shutdown abort 如果数据库是打开状态,强行关闭
2.$ sqlplus /nolog
SQL> conn /as sysdba;
3. SQL> startup
ORACLE instance started.
Total System Global Area 3273641984 bytes
Fixed Size 2257680 bytes
Variable Size 1862274288 bytes
Database Buffers 1392508928 bytes
Redo Buffers 16601088 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/data/oradata/rxdb/system01.dbf'
ORA-01207: file is more recent than control file - old control file
SQL>
4.SQL> alter database backup controlfile to trace as '/home/oracle/aa';
Database altered.
5.SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
6. SQL> startup nomount;
ORACLE instance started.
Total System Global Area 3273641984 bytes
Fixed Size 2257680 bytes
Variable Size 1862274288 bytes
Database Buffers 1392508928 bytes
Redo Buffers 16601088 bytes
SQL>
7. Editplus之类的编辑器打开在第4步生成的aa文件;
其实在这个文件中的已经告诉你怎么样恢复你的数据库了,找到STARTUP NOMOUNT字样,然后下面可以看到类似语句,这个文件有好几个类似的生成控制文件语句,主要针对不懂的环境执行不同的语句
CREATE CONTROLFILE REUSE DATABASE "RXDB" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/data/oradata/rxdb/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/data/oradata/rxdb/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/data/oradata/rxdb/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/data/oradata/rxdb/system01.dbf',
'/data/oradata/rxdb/sysaux01.dbf',
'/data/oradata/rxdb/undotbs01.dbf',
'/data/oradata/rxdb/users01.dbf',
'/data/oradata/rxdb/user_cgs_tbs.dbf'
CHARACTER SET ZHS16GBK
;
执行上面这段语句,这个语句重建控制文件,然后你可以看着aa文件完成下面的恢复工作了
8.SQL>RECOVER DATABASE (恢复指定表空间、数据文件或整个数据库
9.SQL>ALTER DATABASE OPEN 打开数据库
10.验证是否正常启动
关闭数据库:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
启动数据库:
SQL> startup
ORACLE instance started.
Total System Global Area 3273641984 bytes
Fixed Size 2257680 bytes
Variable Size 1862274288 bytes
Database Buffers 1392508928 bytes
Redo Buffers 16601088 bytes
Database mounted.
Database opened.