控制文件重建
时间:2010-11-16 来源:ank
Step1:导出控制文件的中的内容
由于控制文件是二进制,无法用vi直接查看
方法一:直接dump controlfile
alter system set events 'immediate trace name controlf level 10'
方法二:trace
alter database backup controlfile to trace ;//udump <sid>_ora_<pid>.trc
方法三:alter database backup controlfile to 文件名
Step2:找出控制文件中最少需要重建控制文件的参数
CREATE CONTROLFILE REUSE DATABASE "NODE2" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/NODE2/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/NODE2/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/NODE2/redo03.log' SIZE 50M
DATAFILE
'/u01/app/oracle/oradata/NODE2/system01.dbf',
'/u01/app/oracle/oradata/NODE2/undotbs01.dbf',
'/u01/app/oracle/oradata/NODE2/sysaux01.dbf',
'/u01/app/oracle/oradata/NODE2/users01.dbf',
'/u01/app/oracle/oradata/NODE2/example01.dbf',
'/u01/rman.dbf'
CHARACTER SET WE8ISO8859P1
;
Step3:开始重建
SQL>startup nomount
CREATE CONTROLFILE REUSE DATABASE "NODE2" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/NODE2/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/NODE2/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/NODE2/redo03.log' SIZE 50M
DATAFILE
'/u01/app/oracle/oradata/NODE2/system01.dbf',
'/u01/app/oracle/oradata/NODE2/undotbs01.dbf',
'/u01/app/oracle/oradata/NODE2/sysaux01.dbf',
'/u01/app/oracle/oradata/NODE2/users01.dbf',
'/u01/app/oracle/oradata/NODE2/example01.dbf',
'/u01/rman.dbf'
CHARACTER SET WE8ISO8859P1
;
SQL>shutdown immediate
SQL>startup //直接接上部,alter database open
一般到此需要介质恢复
SQL>recover datafile '/u01/app/oracle/oradata/NODE2/system01.dbf'
SQL>recover datafile '/u01/app/oracle/oradata/NODE2/undotbs01.dbf'
SQL>recover datafile '/u01/app/oracle/oradata/NODE2/sysaux01.dbf'
SQL>recover datafile '/u01/app/oracle/oradata/NODE2/users01.dbf'
SQL>recover datafile '/u01/app/oracle/oradata/NODE2/example01.dbf'
SQL>recover datafile '/u01/rman.dbf'
重新打开数据库,
SQL>recover database until cancel;
SQL>alter database open resetlogs
Step4:注意做一次全备