场景:存储介质被破坏,造成
控制文件丢失,需更换硬盘,并重新建立控制文件。
(1)修改初始化参数control_files,改变控制文件位置
SQL> ALTER SYSTEM SET CONTROL_FILES='/disk1/oradata/control01.ctl','/disk2/oradata/control.ctl' scope=spfile;
(2)关闭数据库
SQL>shutdown immediate
(3)启动实例
SQL>startup nomount
SQL> select value from v$parameter where name=’control_files';
(4)建立控制文件
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf',
'/u01/app/oracle/oradata/orcl/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl/users01.dbf',
'/u01/app/oracle/oradata/orcl/example01.dbf'
CHARACTER SET WE8ISO8859P1;
注意:
NORESETLOGS 选项用于指定仍然使用原有的重做日志
RESETLOGS 不使用原有的重做日志
(5)打开数据库
SQL> ALTER DATABASE OPEN;
(6)增加临时文件
SQL>alter database temp add tempfile ‘/disk1/oradata/temp01.dbf' size 50m reuse autoextend off;