重建步骤:
1、生成trace文件:
alter database backup controlfile to trace;
2、找到生成的trace文件:
show parameter dump
user_dump_dest 文件对应的路径即为trace文件的路径
3、关闭数据库
shutdown immediate
4、查看trace文件(我的trace文件路径为:/u01/app/oracle/diag/rdbms/lgr/LGR/trace)
ls -lt /u01/app/oracle/diag/rdbms/lgr/LGR/trace |more
查看:实例名ora数字_.trc的文件
5、复制trace文件的内容:
tail -100 /u01/app/oracle/diag/rdbms/lgr/LGR/trace/LGR_ora_7900.trc
复制内容如下(文件中从STARTUP NOMOUNT开始,到– Commands to re-create incarnation table
之间的内容):
6、创建sql脚本:
随便一个目录,创建一个脚本,把4中复制的内容粘贴到脚本:
[oracle@localhost ~]$ vi createtcl.sql
[oracle@localhost ~]$ cat createtcl.sql
CREATE CONTROLFILE REUSE DATABASE "LGR" RESETLOGS NOARCHIVELOG
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/lgr/redo01a.log' SIZE 100M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/lgr/redo02a.log' SIZE 100M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/oradata/lgr/redo03a.log' SIZE 100M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/lgr/system01.dbf',
'/u01/app/oracle/oradata/lgr/sysaux01.dbf',
'/u01/app/oracle/oradata/lgr/undotbs01.dbf',
'/u01/app/oracle/oradata/lgr/users01.dbf',
'/u01/app/oracle/oradata/lgr/
lgr.dbf',
'/u01/app/oracle/oradata/lgr/ts1',
'/u01/app/oracle/oradata/lgr/ts2',
'/u01/app/oracle/oradata/lgr/ts_idx02.dbf',
'/u01/app/oracle/oradata/lgr/tbs.dbf'
CHARACTER SET AL32UTF8
;
7、nomount状态下运行创建的脚本:
sqlplus / as sysdba
startup nomount
SYS@LGR> @createtcl.sql
Control file created.
8、启动数据库,完成控制文件的重做:
alter database open
注:如果在8中出现“ORA-01589:must use RESETLOGS or NORESETLOGS option for database open”
解决办法:数据库在mount状态下运行:alter database open resetlogs;