代码改变世界

Oracle删除控制文件恢复

2018-03-07 09:11  staryea-bigdata  阅读(1828)  评论(0编辑  收藏  举报

控制文件被删除后,系统崩溃,下面介绍下如何恢复控制文件

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup nomount;
ORA-27102: out of memory
Linux Error: 12: Cannot allocate memory
SQL> startup nomount pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora'
ORACLE instance started.

Total System Global Area 402653184 bytes
Fixed Size 1219688 bytes
Variable Size 209716120 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes

SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info


SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
9 GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
10 GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
11 -- STANDBY LOGFILE
12 DATAFILE
13 '/u01/app/oracle/oradata/orcl/system01.dbf',
14 '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
15 '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
16 '/u01/app/oracle/oradata/orcl/users01.dbf',
17 '/u01/app/oracle/oradata/orcl/example01.dbf',
18 '/u01/app/oracle/oradata/orcl/perfstat.dbf'
19 CHARACTER SET ZHS16GBK
20 ;

Control file created.

 

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'


SQL> recover database;
Media recovery complete.
SQL> alter database open;

Database altered.