'/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf',
'/u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf',
'/u01/app/oracle/oradata/ORA11GR2/users01.dbf',
'/u01/app/oracle/oradata/ORA11GR2/example01.dbf'
CHARACTER SET AL32UTF8
;
……
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_1_694825248.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_1_799882343.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Files in read-only tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00006'
TO '/u01/app/oracle/oradata/ORA11GR2/ts_users01.dbf';
ALTER DATABASE RENAME FILE 'MISSING00007'
TO '/u01/app/oracle/oradata/ORA11GR2/ts_users02.dbf';
-- Online the files in read-only tablespaces.
ALTER TABLESPACE "TS_USERS" ONLINE;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/ORA11GR2/temp01.dbf'
SIZE 30408704 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
……
注 在转储的控制文件中,没有只读表空间的内容
本测试,是先生成转储文件,再恢复的,往往在控制文件丢失之前很少会有人转储控制文件的(当然
了,一般情况都会备份控制文件的),如果没有转储控制文件的话,我们也可以在其他数据库中转储
控制文件,按照目标库的情况进行调整,然后再创建。
5) 手工删除控制文件
[oracle@ocmu ORA11GR2]$ pwd
/u01/app/oracle/oradata/ORA11GR2
[oracle@ocmu ORA11GR2]$ ls *.ctl
control01.ctl control02.ctl
[oracle@ocmu ORA11GR2]$ rm *.ctl
[oracle@ocmu ORA11GR2]$ ls *.ctl
ls: *.ctl: No such file or directory
[oracle@ocmu ORA11GR2]$
6) 控制文件删除以后,数据库是可以正常登陆的
[oracle@ocmu ORA11GR2]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 15 16:09:53 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@ORA11GR2>
7) 当修改结构信息时,会写控制文件,我们创建一个表空间,立即报错
SYS@ORA11GR2> create tablespace ts_idx datafile '/u01/app/oracle/oradata/
ORA11GR2/ts_idx01.dbf' size 10m;
create tablespace ts_idx datafile '/u01/app/oracle/oradata/ORA11GR2/ts_idx01.dbf' size 10m
*
ERROR at line 1:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SYS@ORA11GR2>
8) 一致性关闭数据库已经不可能了(控制文件丢失,无法同步SCN),采取强制手段
SYS@ORA11GR2>shutdow immediate;
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SYS@ORA11GR2>
SYS@ORA11GR2>shutdown abort;
ORACLE instance shut down.
SYS@ORA11GR2>
9) 按照转储文件中的步骤恢复控制文件,nomount启动数据库
SYS@ORA11GR2>startup nomount;
ORACLE instance started.
Total System Global Area 841162752 bytes
Fixed Size 1339768 bytes
Variable Size 494931592 bytes
Database Buffers 339738624 bytes
Redo Buffers 5152768 bytes
SYS@ORA11GR2>
10) 采用NORESETLOGS创建控制文件
SYS@ORA11GR2>CREATE CONTROLFILE REUSE DATABASE "ORA11GR2" NORESETLOGS NOARCHIVE