重建控制文件是不得已之选,如果没有备份和控制文件冗余的情况下,但是我们仍需要一些数据库信息,下面简单的介绍一下过程:
把数据库启动到mount:
SQL> startup mount;
ORACLE 例程已经启动。
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 327158144 bytes
Database Buffers 88080384 bytes
Redo Buffers 6094848 bytes
数据库装载完毕。
SQL> alter database backup controlfile to trace;
数据库已更改。
我们打开trace文件,里面有我们重建控制文件的脚本:
CREATE CONTROLFILE REUSE DATABASE "ORCL3939" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl3939/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/orcl3939/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/oradata/orcl3939/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/orcl3939/system01.dbf',
'/u01/app/oracle/oradata/orcl3939/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl3939/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl3939/users01.dbf',
'/u01/app/oracle/oradata/orcl3939/example01.dbf',
'/u01/app/oracle/oradata/orcl3939/wang.dbf',
'/u01/app/oracle/oradata/orcl3939/chao.dbf',
'/u01/app/oracle/oradata/orcl3939/big_file',
'/u01/app/oracle/oradata/orcl3939/undo_w.dbf',
'/u01/app/oracle/oradata/orcl3939/wang1.dbf',
'/u01/app/oracle/oradata/orcl3939/a.dbf',
'/u01/app/oracle/oradata/orcl3939/v.dbf'
CHARACTER SET AL32UTF8
;
通过此脚本,我们可以重建控制文件:
把数据库启动到mount:
SQL> startup mount;
ORACLE 例程已经启动。
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 327158144 bytes
Database Buffers 88080384 bytes
Redo Buffers 6094848 bytes
数据库装载完毕。
SQL> alter database backup controlfile to trace;
数据库已更改。
我们打开trace文件,里面有我们重建控制文件的脚本:
CREATE CONTROLFILE REUSE DATABASE "ORCL3939" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl3939/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/orcl3939/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/oradata/orcl3939/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/orcl3939/system01.dbf',
'/u01/app/oracle/oradata/orcl3939/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl3939/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl3939/users01.dbf',
'/u01/app/oracle/oradata/orcl3939/example01.dbf',
'/u01/app/oracle/oradata/orcl3939/wang.dbf',
'/u01/app/oracle/oradata/orcl3939/chao.dbf',
'/u01/app/oracle/oradata/orcl3939/big_file',
'/u01/app/oracle/oradata/orcl3939/undo_w.dbf',
'/u01/app/oracle/oradata/orcl3939/wang1.dbf',
'/u01/app/oracle/oradata/orcl3939/a.dbf',
'/u01/app/oracle/oradata/orcl3939/v.dbf'
CHARACTER SET AL32UTF8
;
通过此脚本,我们可以重建控制文件:
SQL> startup nomount;
ORACLE 例程已经启动。
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 327158144 bytes
Database Buffers 88080384 bytes
Redo Buffers 6094848 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL3939" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl3939/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/orcl3939/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/oradata/orcl3939/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/orcl3939/system01.dbf',
'/u01/app/oracle/oradata/orcl3939/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl3939/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl3939/users01.dbf',
'/u01/app/oracle/oradata/orcl3939/example01.dbf',
'/u01/app/oracle/oradata/orcl3939/wang.dbf',
'/u01/app/oracle/oradata/orcl3939/chao.dbf',
'/u01/app/oracle/oradata/orcl3939/big_file',
'/u01/app/oracle/oradata/orcl3939/undo_w.dbf',
'/u01/app/oracle/oradata/orcl3939/wang1.dbf',
'/u01/app/oracle/oradata/orcl3939/a.dbf',
'/u01/app/oracle/oradata/orcl3939/v.dbf'
CHARACTER SET AL32UTF8
ORACLE 例程已经启动。
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 327158144 bytes
Database Buffers 88080384 bytes
Redo Buffers 6094848 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL3939" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl3939/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/orcl3939/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/oradata/orcl3939/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/orcl3939/system01.dbf',
'/u01/app/oracle/oradata/orcl3939/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl3939/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl3939/users01.dbf',
'/u01/app/oracle/oradata/orcl3939/example01.dbf',
'/u01/app/oracle/oradata/orcl3939/wang.dbf',
'/u01/app/oracle/oradata/orcl3939/chao.dbf',
'/u01/app/oracle/oradata/orcl3939/big_file',
'/u01/app/oracle/oradata/orcl3939/undo_w.dbf',
'/u01/app/oracle/oradata/orcl3939/wang1.dbf',
'/u01/app/oracle/oradata/orcl3939/a.dbf',
'/u01/app/oracle/oradata/orcl3939/v.dbf'
CHARACTER SET AL32UTF8
接下来,我们恢复数据库:
SQL>recover database using backup controlfile;这个过程会用到归档日志,用完归档日志,会用重做日志文件
SQL>recover database using backup controlfile;
然后我们打开数据库:
SQL>alter database open resetlogs;
Database altered;
因为控制文件中没有临时表空间,我们可以通过手工添加临时表空间:
SQL>recover database using backup controlfile;这个过程会用到归档日志,用完归档日志,会用重做日志文件
SQL>recover database using backup controlfile;
然后我们打开数据库:
SQL>alter database open resetlogs;
Database altered;
alter tablespace temp add tempfile 'XXXXXXXX' size xx reuse autoextend on next xxx;