1. 首页
  2. IT资讯

重建控制文件

重建控制文件是不得已之选,如果没有备份和控制文件冗余的情况下,但是我们仍需要一些数据库信息,下面简单的介绍一下过程:
把数据库启动到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

接下来,我们恢复数据库:
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;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29876893/viewspace-1575070/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:℅傍ㄖ免沦陷dε鬼,转转请注明出处:http://www.cxybcw.com/192077.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code